Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected top-level error

I have been trying many solutions even enabled multiDexEnabled true, but still getting this error UNEXPECTED TOP-LEVEL ERROR. This is my build

android {
compileSdkVersion 22
buildToolsVersion '22.0.1'

defaultConfig {
    applicationId "com.xxx"
    minSdkVersion 11
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

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

}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.googlecode.libphonenumber:libphonenumber:6.2'
compile 'com.paypal.sdk:paypal-android-sdk:2.12.4'
compile 'com.android.support:design:22.2.1'
compile 'com.google.zxing:core:3.2.0'
compile 'com.android.support:multidex:1.0.1'
}

I am getting this Error

    UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at com.android.dx.rop.code.PlainInsn.withNewRegisters(PlainInsn.java:152)
    at com.android.dx.ssa.NormalSsaInsn.toRopInsn(NormalSsaInsn.java:126)
    at com.android.dx.ssa.back.SsaToRop.convertInsns(SsaToRop.java:341)
    at com.android.dx.ssa.back.SsaToRop.convertBasicBlock(SsaToRop.java:322)
    at com.android.dx.ssa.back.SsaToRop.convertBasicBlocks(SsaToRop.java:259)
    at com.android.dx.ssa.back.SsaToRop.convert(SsaToRop.java:123)
    at com.android.dx.ssa.back.SsaToRop.convertToRopMethod(SsaToRop.java:69)
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:101)
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:297)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93)
    at com.android.dx.command.dexer.Main.processClass(Main.java:729)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
    at com.android.dx.command.dexer.Main.access$300(Main.java:83)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:632)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:505)
    at com.android.dx.command.dexer.Main.runMultiDex(Main.java:334)
    at com.android.dx.command.dexer.Main.run(Main.java:244)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)


 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 3

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

What am i doing wrong here, I is it a library conflict or am i missing something here

like image 877
Ceddy Muhoza Avatar asked Jan 21 '16 00:01

Ceddy Muhoza


1 Answers

add this to your build.gradle (after your buildTypes)

dexOptions {
    javaMaxHeapSize "4g"
}
like image 120
Bronx Avatar answered Nov 10 '22 21:11

Bronx