当 buildToolsVersion 从 22.0.1 更改为 23.0.1 时的 ProcessException [英] ProcessException when buildToolsVersion is changed from 22.0.1 to 23.0.1

查看:17
本文介绍了当 buildToolsVersion 从 22.0.1 更改为 23.0.1 时的 ProcessException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看到ProcessException,这似乎是一个老问题,但在我的情况下,此异常的原因是不同的.我试图将 compileSDKVersion 从 22 移动到 23.我还将 buildToolsVersion 从 22.0.1 更改为 23.0.1.当我只更改 compileSDKVersion 时,gradle 同步和构建成功.但是在将构建版本更改为 23.0.1 后,gradle 同步成功但编译失败并出现 ProcessException.

Seeing ProcessException, it seems to be an old question but the cause for this exception in my case is different. I am trying to move compileSDKVersion from 22 to 23. I also changed the buildToolsVersion from 22.0.1 to 23.0.1. When I changed only the compileSDKVersion, the gradle sync and build is successful. But after changing the build version to 23.0.1, gradle sync is successful but compilations failed with ProcessException.

以下是异常详情:

processing com/google/android/gms/tagmanager/zzad.class...

Unknown source file : UNEXPECTED TOP-LEVEL ERROR:
Unknown source file : java.lang.OutOfMemoryError: GC overhead limit exceeded
Unknown source file :   at com.android.dx.rop.cst.CstString.utf8BytesToString(CstString.java:158)
Unknown source file :   at com.android.dx.rop.cst.CstString.<init>(CstString.java:200)
Unknown source file :   at com.android.dx.cf.cst.ConstantPoolParser.parseUtf8(ConstantPoolParser.java:371)
Unknown source file :   at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:262)
Unknown source file :   at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:288)
Unknown source file :   at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:150)
Unknown source file :   at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)
Unknown source file :   at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)
Unknown source file :   at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:482)
Unknown source file :   at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
Unknown source file :   at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
Unknown source file :   at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
Unknown source file :   at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
Unknown source file :   at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
Unknown source file :   at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
Unknown source file :   at com.android.dx.command.dexer.Main.processClass(Main.java:749)
Unknown source file :   at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
Unknown source file :   at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
Unknown source file :   at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
Unknown source file :   at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
Unknown source file :   at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
Unknown source file :   at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
Unknown source file :   at com.android.dx.command.dexer.Main.processOne(Main.java:672)
Unknown source file :   at com.android.dx.command.dexer.Main.processAllFiles(Main.java:569)
Unknown source file :   at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
Unknown source file :   at com.android.dx.command.dexer.Main.run(Main.java:275)
Unknown source file :   at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file :   at com.android.dx.command.Main.main(Main.java:106)

:app:dexDebug FAILED
:app:dexDebug (Thread[main,5,main]) completed. Took 1 mins 14.503 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 24.421 secs
Stopped 0 compiler daemon(s).

我将堆空间增加到 2048m.
尝试了我所知道的所有方法,例如 build clean、gradle clean、重建项目、重新加载项目、重新启动工作室等.
其他 stackoverflow 答案说这可能是因为同一个库被多次编译,所以我在 gradle 中将 multiDexEnabled = true 添加到我的 defaultConfig 中.这没有帮助.

I increased heap space to 2048m.
Tried all the ways I know like build clean, gradle clean, rebuilding project, reloading the project, restarting the studio etc.
Other stackoverflow answers says it might be due to that the same lib is being compiled multiple times so I added multiDexEnabled = true to my defaultConfig in gradle. This did not help.

下面是我的毕业证:

    apply plugin: 'com.android.application'  
android {
    lintOptions {
        abortOnError false
    }

    compileSdkVersion 23
    buildToolsVersion '23.0.1'

    defaultConfig {
    applicationId "com.pfoinc.shield"
    minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
    targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
    versionCode Integer.parseInt(project.VERSION_CODE)
    versionName project.VERSION_NAME
    multiDexEnabled = true
}

    buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':MrVector')
    compile project(':MorphingNumber')
    compile 'com.android.support:recyclerview-v7:22.1.0'
    compile 'com.android.support:support-v4:22.1.0'
    compile 'com.android.support:cardview-v7:22.1.0'
    compile 'com.android.support:appcompat-v7:22.1.0'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.facebook.android:facebook-android-sdk:3.23.1'
    compile 'com.github.ksoichiro:androidcolorfulicons:0.1.1'
    compile 'fr.baloomba:viewpagerindicator:2.4.2'
    compile 'com.pkmmte.view:circularimageview:1.1'
    compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
    compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
    compile 'com.squareup.okhttp:okhttp:2.5.0'
    compile 'com.sothree.slidinguppanel:library:3.0.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.getbase:floatingactionbutton:1.9.0'
    compile 'com.android.support:design:23.0.1'
    compile 'net.hockeyapp.android:HockeySDK:3.5.0'
    compile 'jp.wasabeef:recyclerview-animators:1.2.0@aar'
    compile 'com.google.guava:guava:18.0'
    compile 'com.theartofdev.edmodo:android-image-cropper:1.0.4'
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.google.android.gms:play-services-ads:8.1.0'
    compile 'com.google.android.gms:play-services-identity:8.1.0'
    compile 'com.google.android.gms:play-services-gcm:8.1.0'
}

提前致谢.

推荐答案

我认为问题可能出在您的依赖项闭包中:

I think that the problem can be in your dependencies closure:

首先,您的 Google Play 服务配置是多余的,您正在编译完整的 Play 服务 API 和单独的 Play 服务 API.尝试仅使用个人 Play 服务.蜜蜂.请参阅 Google Play 服务设置文档.

First, your Google Play Services configuration are redundant, you are compiling full Play Services APIs and individuals Play Services APIs. Try to only use individuals Play Services. APIs. See Google Play Services Setup Docs.

其次,可能你的 multidex 配置有误,参见 Multidex Docs

Second, maybe your multidex configuration is wrong, see Multidex Docs

第三,尝试将您的 android 支持依赖项更新到可用的最新版本

Third, try to update your android support dependencies to the last version available

更新

根据 gcr 的反馈,该问题是由 Google Play 服务(同一 build.gradle 文件中的完整 API 和个人 API)中的依赖项重复引起的.

By gcr's feedback, the issue was caused by dependency-duplication in Google Play services (full APIs and individuals APIs in the same build.gradle file).

这篇关于当 buildToolsVersion 从 22.0.1 更改为 23.0.1 时的 ProcessException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆