[英]Slow build gradle in android
我檢查了有關慢速gradle構建的所有問題。 (例如這里 , 這里和......)。但是在我的項目中構建gradle太慢了。 有時哪個建築需要5-8分鍾,我在很多地方搜索,現在我很累
Build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "..."
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
jackOptions {
enabled true
additionalParameters('jack.incremental': 'true')
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
compileOptions {
incremental true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile files('libs/TelegramNewApiLibrary.jar')
compile files('libs/TelegramNewConvert.jar')
}
repositories {
mavenCentral()
}
build.gradle(模塊應用):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle.properties:
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.daemon = true
禁用我的防病毒功能,並在項目中啟用脫機工作。
系統Ram:4G
系統CPU:3.10 GH
Android Studio版本:2.2.3
任何人都可以幫助我嗎?
了解Gradle Build與CPU速度或RAM無關。 構建在PC中變慢的原因是因為您的Internet連接。 構建可能需要大約約100 MB。 數據來完成它的過程。 即使您的Internet連接速度很快且連接的PING速度很慢,也需要更多時間。 謝謝你的時間。
嘗試將AndroidStudio更新為3.0,升級gradle gradle:2.2.3 => gradle:3.0.0和buildtools buildToolsVersion '25 .0.2'=> buildToolsVersion '26 .0.2'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.