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

问题描述

眼看ProcessException,这似乎是一个老问题,但对此的原因除了在我的情况是不同的。我想从22到23,我也改变了buildToolsVersion从22.0.1至23.0.1移动compileSDKVersion。当我改变只是compileSDKVersion的摇篮同步和构建成功。但改变内部版本号为23.0.1后,摇篮同步是成功的,但编译失败,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).

我增加堆空间2048米。
 尝试了所有我知道像打造干净,整洁摇篮,重建项目的方式,重新加载项目,重新启动工作室等
其他计算器回答说,这可能是因为,同样的lib目录中,所以我说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'
}

在此先感谢。

Thanks in advance.

推荐答案

我认为这个问题可以在你的依赖关闭:

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

首先,你的谷歌播放服务的配置是多余的,您是编译充分发挥服务API和个人播放服务API。尽量只使用个人播放服务。蜜蜂。请参见谷歌播放服务设置文档

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文档

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的反馈,问题是由相关的重复数据删除在谷歌(在同一个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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!