看到ProcessException,它似乎是一个老问题,但在我的情况下这个异常的原因是不同的。我试图将compileSDKVersion从22移动到23.我还将buildToolsVersion从22.0.1更改为23.0.1。 当我只更改了compileSDKVersion时,gradle同步和构建成功。但是在将构建版本更改为23.0.1之后,gradle sync成功但编译失败并且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
尝试了我所知道的所有方法,例如构建清洁,清洁,重建项目,重新加载项目,重新启动工作室等。
其他stackoverflow答案说它可能是由于同一个lib被多次编译所以我在gradle中将multiDexEnabled = true添加到我的defaultConfig。这没有用。
以下是我的傻瓜:
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'
}
提前致谢。
答案 0 :(得分:1)
我认为问题可能出在你的依赖关系中:
首先,您的Google Play服务配置是多余的,您正在编译完整的Play服务API和个人Play服务API。尽量只使用个人Play服务。蜜蜂。请参阅Google Play Services Setup Docs。
其次,您的multidex配置可能有误,请参阅Multidex Docs
第三,尝试将您的Android支持依赖项更新为可用的最新版本
<强>更新强>
根据gcr的反馈,问题是由Google Play服务中的依赖项重复造成的(同一build.gradle文件中的完整API和个人API)。