Project build once too slow through various search integrations the following is for reference only
1. Create a new Gradle.properties file in the following directory
/home//.gradle/(Linux)
/users//.gradle/(MAC)
C:\Users\\.gradle (Windows)
Add in File
Org.gradle.daemon=true
2, in the Local project Gradle.properties add the following
Org.gradle.jvmargs=-xmx2048m-xx:maxpermsize=512m-xx:+heapdumponoutofmemoryerror-dfile.encoding=utf-8
Org.gradle.parallel=true
Org.gradle.configureondemand=true
Org.gradle.daemon=true
You can also set the global properties as above so the project will follow this setting
3, open File-setting-build-compiler for the following settings!
Open File-setting-build-buildtool for the following settings
Set to offline here and apply local Gradle speed up compilation
4. Open File-project Structure
Set version of Gradle
5. Under your app Gradle, add the following
dexoptions {
Incremental =true
Javamaxheapsize "4g"//here can be configured according to the computer itself the larger the value of course the faster
Predexlibraries = False
}
6, in addition, due to domestic visits to foreign servers slow caused as and card and slow, so try to use Jar arr and other ways to reduce direct compile
*.jar: Contains only the class file and the manifest file, does not contain the resource file, the slice and so on all res files.
*.aar: Contains all resources, class, and res resource files all contain
If you are just a simple class library then use the generated *.jar file;
If you have a UI library that contains resource files such as control layout files and fonts, you can only use the *.aar file.
Speed up Android Studio compilation Speed ZZ