Android Studio Gradle 冻结:app:transformClassesWithDexForRelease
Android Studio Gradle freeze on :app:transformClassesWithDexForRelease
将一些库添加到我们的 Android 项目并将 compileSdkVersion 更改为 26 后,我们的应用程序停止在发布配置中构建。该过程在以下阶段停止在 93%:app:transformClassesWithDexForRelease 并且在工作 15 分钟后没有任何变化。此时,处理器负载为 75%,RAM 为 83%。
我们使用 Android Studio 3.0、gradle 2.3.3、Windows 10 x86 和 3GB RAM。
我们还尝试为 javaMaxHeapSize 设置不同的值。这是我们的 build.gradle 文件:
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
versionCode 204
versionName "2.4"
applicationId "ua.ers.simpleVpn"
//testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "1g"
}
}
repositories {
flatDir {
dirs 'libs-aar'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//compile fileTree(include: ['*.jar'], dir: 'libs/appodeal')
compile fileTree(include: ['*.jar'], dir: 'libs/appodeal_dex')
compile project(':library-circular-mod')
compile project(':complexPreferences')
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.ads.consent:consent-library:1.0.3'
testCompile 'junit:junit:4.12'
//Appodeal
compile 'com.google.android.gms:play-services-ads:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.android.gms:play-services-gcm:15.0.1'
//Appodeal
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.picasso:picasso:2.5.2'
//for Inmobi
compile name: 'adcolony-sdk-3.3.0', ext: 'aar'
compile name: 'mobvista-8.11.0-alphab', ext: 'aar'
compile name: 'mobvista-8.11.0-common', ext: 'aar'
compile name: 'mobvista-8.11.0-interstitial', ext: 'aar'
compile name: 'mobvista-8.11.0-interstitialvideo', ext: 'aar'
compile name: 'mobvista-8.11.0-mvdownloads', ext: 'aar'
compile name: 'mobvista-8.11.0-mvjscommon', ext: 'aar'
compile name: 'mobvista-8.11.0-mvnative', ext: 'aar'
compile name: 'mobvista-8.11.0-nativeex', ext: 'aar'
compile name: 'mobvista-8.11.0-playercommon', ext: 'aar'
compile name: 'mobvista-8.11.0-reward', ext: 'aar'
compile name: 'mobvista-8.11.0-videocommon', ext: 'aar'
compile name: 'mobvista-8.11.0-videofeeds', ext: 'aar'
compile name: 'mobvista-8.11.0-videojs', ext: 'aar'
}
请帮助,因为我们已经为这个问题苦苦挣扎了一个多星期,而且应用程序的更新时间很紧。谢谢。
按照 Android docs 中的建议。 推荐内存为8gb,我只是想知道你能不能在3gb ram系统中运行 Android Studio。因为我有 10gb 内存,其中 6gb 内存总是由 JDK (3gb) 和 Android Studio (3gb).我的系统有 i7 处理器,当我处理数据绑定时它会挂起。
你的应用程序 运行 在低配置系统上没有太多依赖项,但如果项目要大结构和更多依赖项,你将需要至少 8GB 内存。
解决方案:
- 将 ram 增加到至少 8gb。
- 尝试使用一些有用的 类 而不是依赖项中的所有包。
- 清理项目,有时未使用的包保留在 Build 中。
- 如果您正在构建发布应用程序,请使用混淆器(将删除未使用的 类 和资源本身)。
将一些库添加到我们的 Android 项目并将 compileSdkVersion 更改为 26 后,我们的应用程序停止在发布配置中构建。该过程在以下阶段停止在 93%:app:transformClassesWithDexForRelease 并且在工作 15 分钟后没有任何变化。此时,处理器负载为 75%,RAM 为 83%。 我们使用 Android Studio 3.0、gradle 2.3.3、Windows 10 x86 和 3GB RAM。 我们还尝试为 javaMaxHeapSize 设置不同的值。这是我们的 build.gradle 文件:
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
versionCode 204
versionName "2.4"
applicationId "ua.ers.simpleVpn"
//testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "1g"
}
}
repositories {
flatDir {
dirs 'libs-aar'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//compile fileTree(include: ['*.jar'], dir: 'libs/appodeal')
compile fileTree(include: ['*.jar'], dir: 'libs/appodeal_dex')
compile project(':library-circular-mod')
compile project(':complexPreferences')
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.ads.consent:consent-library:1.0.3'
testCompile 'junit:junit:4.12'
//Appodeal
compile 'com.google.android.gms:play-services-ads:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.android.gms:play-services-gcm:15.0.1'
//Appodeal
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.picasso:picasso:2.5.2'
//for Inmobi
compile name: 'adcolony-sdk-3.3.0', ext: 'aar'
compile name: 'mobvista-8.11.0-alphab', ext: 'aar'
compile name: 'mobvista-8.11.0-common', ext: 'aar'
compile name: 'mobvista-8.11.0-interstitial', ext: 'aar'
compile name: 'mobvista-8.11.0-interstitialvideo', ext: 'aar'
compile name: 'mobvista-8.11.0-mvdownloads', ext: 'aar'
compile name: 'mobvista-8.11.0-mvjscommon', ext: 'aar'
compile name: 'mobvista-8.11.0-mvnative', ext: 'aar'
compile name: 'mobvista-8.11.0-nativeex', ext: 'aar'
compile name: 'mobvista-8.11.0-playercommon', ext: 'aar'
compile name: 'mobvista-8.11.0-reward', ext: 'aar'
compile name: 'mobvista-8.11.0-videocommon', ext: 'aar'
compile name: 'mobvista-8.11.0-videofeeds', ext: 'aar'
compile name: 'mobvista-8.11.0-videojs', ext: 'aar'
}
请帮助,因为我们已经为这个问题苦苦挣扎了一个多星期,而且应用程序的更新时间很紧。谢谢。
按照 Android docs 中的建议。 推荐内存为8gb,我只是想知道你能不能在3gb ram系统中运行 Android Studio。因为我有 10gb 内存,其中 6gb 内存总是由 JDK (3gb) 和 Android Studio (3gb).我的系统有 i7 处理器,当我处理数据绑定时它会挂起。
你的应用程序 运行 在低配置系统上没有太多依赖项,但如果项目要大结构和更多依赖项,你将需要至少 8GB 内存。
解决方案:
- 将 ram 增加到至少 8gb。
- 尝试使用一些有用的 类 而不是依赖项中的所有包。
- 清理项目,有时未使用的包保留在 Build 中。
- 如果您正在构建发布应用程序,请使用混淆器(将删除未使用的 类 和资源本身)。