android studio构建项目一直卡在gradle build running界面

翻译 2016年05月31日 21:24:29

来源这里

http://stackoverflow.com/questions/16775197/building-and-running-app-via-gradle-and-android-studio-is-slower-than-via-eclips


1.

(创建一个文件名叫gradle.properties,放在对应一下的目录

Create a file named gradle.properties in whatever directory applies:

/home/<username>/.gradle/ (linux)

/Users/<username>/.gradle/ (Mac)

C:\Users\<username>\.gradle (Windows)

org.gradle.daemon=true

2.

IDE Settings

IDE settings

3.

你可以忽略Gradle更新(勾选)

You can ignore gradle update-to-date checks.

enter image description here

原文如下:

Configuration File

Create a file named gradle.properties in whatever directory applies:

  • /home/<username>/.gradle/ (Linux)
  • /Users/<username>/.gradle/ (Mac)
  • C:\Users\<username>\.gradle (Windows)

Append:

org.gradle.daemon=true

Ensure you are using the latest development versions.

Command Line Arguments

The --daemon --parallel --offline command line arguments for Gradle builds work great. Learn about these options from the documentation.

Overview

An optimized Gradle properties file (gradle.properties) includes:

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
# TODO: disable daemon on CI, since builds should be clean and reliable on servers
org.gradle.daemon=true

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

# Enables new incubating mode that makes Gradle selective when configuring projects. 
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true

Gradle properties works local if you place them at projectRoot\gradle.properties and globally if you place them at user_home\.gradle\gradle.properties. Properties applied if you run gradle tasks from console or directly from idea:

IDE Settings

Or enable gradle properties from the IDE settings

IDE settings

Dependencies

Prefer @aar dependencies over library projects.

Search aar package on mavenCentral (http://gradleplease.appspot.com/), github (https://github.com/Goddchen/mvn-repo), or build it manually from sources and put into libs folder. If you are not editing sources of the dependency library you should not build it every time with your project sources.

Antivirus

Consider to exclude project and cache files from antivirus scanning. This is obviously a trade off with security (don't try this at home!). But if you switch between branches a lot, then antivirus will rescan files before allowing gradle process to use it, which slows build time (in particular AndroidStudio sync project with gradle files and indexing tasks). Measure build time and process CPU with and without antivirus enabled to see if it is related.

Warning

Don't use auto-import feature (yet) due to known bug which will slow down the IDE.

Fabric Crashlytics

Fabric has typo at the documentation pointing to the private maven repo which needs authorization.http://stackoverflow.com/a/27130652/624706

More Reading

An article on Gradle describes a few settings to increase its speed.


相关文章推荐

Android Studio 运行 Gradle Build Running卡死的解决办法

在使用AS开发安卓应用程序的时候经常会遇到Gradle build running一直在运行甚至卡死的情况,解决方法如下: 1、在C:\User\\.gradle 目录下新建一个gradle.pro...

解决Android Studio Gradle Build Running 特别慢的问题

终于从eclipse逐渐转移到Android Studio上来了。刚开始,真不习惯,感觉又慢,快捷键又和eclipse不一样。但现在越来越多的项目示例等,是android studio格式的,只得慢慢...

Android Studio Gradle Build Running 加载很久问题。

关于Gradle Build Running很慢的问题,网上有很多关于这个问题的解答,如 C:\Users\你的用户名\.gradle目录下新建一个文件名为gradle.properties的文件。...

android studio 一直卡在Gradle:Build Running的解决办法

就在今天studio以前用的好好的,今天突然出现了问题,身边的朋友也有一小半出现这样的问题。用了vpn也没能解决,最终使用下面方法一 解决了我的难点。非常感谢这位大哥。点击打开链接 在使用AS开发...

Android Studio 一直卡在Gradle:Build Running的解决办法

网上方法 一 : 我的没找到这一项 需要在android studio 中配置gradle的代理,当然是用goagent了。 打开setting->gradle->Gradle VM Opt...

android studio 一直卡在Gradle:Build Running的解决办法

参考 http://blog.csdn.net/a549742320/article/details/52525257 在android studio 中配置gradle的代理,用goagent。 ...

gradle build running很久的问题

转自:原文地址:http://blog.isming.me/2015/03/18/android-build-speed-up/,转载请注明出处。  谢谢大神 一.开启gradle单独的守护...

android studio 一直卡在Gradle:Build Running的解决办法

在使用AS开发安卓应用程序的时候经常会遇到Gradle build running一直在运行甚至卡死的情况,本文列出了几种解决方法以供参考。

webstorm很卡 scanning files to index

webstorm 11打开以后底部总是出现一个不停运行的进程,显示scanning files to index,请问怎么解决? 排除你不想索引的文件夹就好了。找到你想排除的文件夹(主要是node_...

webstorm卡在scanning files to index

当项目中文件过多时,会一直卡在建立索引这一步,通常是在 npm install 之后导致,node_modules 中文件太多。解决方法: 将 node_modules 文件夹排除出将要建立索引的...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)