简体   繁体   English

Android工作室非常慢的gradle构建

[英]Android studio very slow gradle build

I'm new to Android Studio..whenever I run my project it takes around 14 mins for gradle build..I've check for solutions to improve build speed as mentioned in here 我是新来的Android Studio..whenever我跑我的项目花费gradle这个build..I've检查大约14分钟的解决方案,以提高建设速度提到这里

My gradle.properties file: 我的gradle.properties文件:

## Project-wide Gradle settings.

org.gradle.daemon=true

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

org.gradle.parallel=true
org.gradle.configureondemand=true

but the problem is still the same and each of these lines are dim in color just like they were comment lines code. 但问题仍然是相同的,这些线条都是暗淡的,就像它们是注释行代码一样。 when the mouse is hovered on top there a message which says "Unused Property. This inspection reports all properties not referenced from outside of the properties file" 当鼠标悬停在顶部时,会显示一条消息,显示“未使用的属性。此检查报告未从属性文件外部引用的所有属性”

how can I fix this? 我怎样才能解决这个问题? Thanks 谢谢

make gradle.properties file in C:\\Users\\<username>\\.gradle (Windows) C:\\Users\\<username>\\.gradle (Windows)创建gradle.properties文件C:\\Users\\<username>\\.gradle (Windows)

then,Add this line to the file: 然后,将此行添加到文件中:

org.gradle.daemon=true

Solution for Linux/OSX may looks like this: Linux / OSX的解决方案可能如下所示:

echo 'org.gradle.daemon=true' >> ~/.gradle/gradle.properties

echo 'org.gradle.configureondemand=true' >> ~/.gradle/gradle.properties

echo 'org.gradle.parallel=true' >> ~/.gradle/gradle.properties

echo 'org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8' >> ~/.gradle/gradle.properties

Using these commands you make changes in global gradle.properties file. 使用这些命令可以在全局gradle.properties文件中进行更改。

More info (together with detailed explanation) can he found here . 他可以在这里找到更多信息(连同详细说明)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM