今天Android的项目开发过程中,Android Studio一直卡在Gradle:Build Running的状态中,耗费了大量的开发时间,所以有必要记录一下这个问题/状况。
解决的方法如下:
1.在C:\Users<用户名>.gradle新建一个PROPERTIES文件 gradle.properties ,文件中添加一下内容:
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx1536m
# 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
如图:
2.在Android Studio中,打开File–>Setting–>Build,Execution,Deployment–>Gradle,勾选Offline Work模式,如图:
直接运行你的项目,安装App过程的时间会大大减少,解决了AS卡在Gradle:Build Running的问题。