Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2019-09-25:如何优化 Gradle 的构建速度? #154

Open
Moosphan opened this issue Sep 25, 2019 · 3 comments
Open

2019-09-25:如何优化 Gradle 的构建速度? #154

Moosphan opened this issue Sep 25, 2019 · 3 comments
Labels

Comments

@Moosphan
Copy link
Owner

No description provided.

@df13954
Copy link

df13954 commented Sep 26, 2019

1:物理设备,16g+内存,硬盘ssd,高配u。最好是超频u。5.0g那种
2:配置.使用高版本as
android.injected.testOnly=false
android.buildCacheDir=buildCacheDir
org.gradle.caching=true
android.enableBuildCache=true
android.enableAapt2=true
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
android.enableSeparateAnnotationProcessing = true

buildTypes{
debug{

crunchPngs false
aaptOptions.cruncherEnabled = false
}
}
dexOptions {
preDexLibraries true
}

如果使用了multiDexEnabled ,一定要依赖最新版本的1.0.3版本
依赖的库不带+号,每次都会自动检查最新版
3:as设置,如果已下载好依赖,可以设置离线模式

以上配置可以加快构建和编译速度。
环境Mac os 14.as 3.2.0

@GodJiong
Copy link

@ff-frida 我看到目前最新的是androidx.multidex:multidex:2.0.0

@senlinxuefeng
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants