2

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.

Below is the exception details:

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).

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.

Below is my gradle :

    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.

cgr
  • 4,578
  • 2
  • 28
  • 52

1 Answers1

1

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

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.

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

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

UPDATE

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).

ClarkXP
  • 1,223
  • 10
  • 23
  • I have removed the play services and added what required. The build went fine now and no ProcessException. Great, thanks! Multidex I recently corrected it so that should be proper. To keep the answer geenric, I suggest you edit answer to say that take care of dependency-duplication. It could be play services or something else. – cgr Nov 20 '15 at 23:06