简体   繁体   中英

another app:dexDebug error Android Studio

I have a working project and Now I want to implement a new library which name is seamless ad network api. While I add the api in dependencies and build it with no problems, I try to debug the app and then it gives the error below.

Error:Execution failed for task ':app:dexDebug'. >com.android.ide.common.process.ProcessException: org.gradle.process.internal. 
ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 3

I tried all different solutions mentioned in similar stackoverflow questions but no luck! I have tried adding multidexEnabled true but didnt work I have tried adding compile 'com.android.support:multidex:1.0.0' but didnt work I have tried to comment out other jar files that mentioned in dependencies but didnt work. what is wrong with this?

here is my build.gradle in app

apply plugin: 'com.android.application'

android 
{
compileSdkVersion 21
buildToolsVersion ANDROID_BUILD_TOOLS_VERSION

defaultConfig {

    minSdkVersion ANDROID_BUILD_MIN_SDK_VERSION
    targetSdkVersion ANDROID_BUILD_TARGET_SDK_VERSION
    multiDexEnabled true
}

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

repositories {
maven {
    url "http://maven.seamlessapi.com:8081/nexus/content/repositories/releases/"
}
}

dependencies {
compile 'com.android.support:appcompat-v7:18.0.+'
//compile files('libs/picasso-2.5.0.jar')
compile project(':Libraries:CropImageLib')
compile project(':Libraries:facebook-android')
compile project(':Libraries:NineOldLibs')
compile project(':Libraries:SlidingMenu')
compile files('libs/JTransforms-3.0.jar')
compile files('libs/JLargeArrays-1.2.jar')
compile files('libs/gdata-core-1.0.jar')
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:support-v4:18.0.+'
compile 'com.goseamless:seamless:2.4.0'
compile 'com.android.support:multidex:1.0.0'
}

here is the full error log

:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:packageAllDebugClassesForMultiDex UP-TO-DATE
:app:shrinkDebugMultiDexComponents UP-TO-DATE
:app:createDebugMainDexClassList UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
at java.util.BitSet.initWords(BitSet.java:166)
at java.util.BitSet.<init>(BitSet.java:161)
at com.android.dx.ssa.SsaMethod.bitSetFromLabelList(SsaMethod.java:137)
at com.android.dx.ssa.SsaBasicBlock.newFromRop(SsaBasicBlock.java:161)
at com.android.dx.ssa.SsaMethod.convertRopToSsaBlocks(SsaMethod.java:173)
at com.android.dx.ssa.SsaMethod.newFromRopMethod(SsaMethod.java:103)
at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:44)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:98)
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)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException:    org.gradle.process.internal.ExecException: Process 'command 'C:\Program   Files\Java\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 3

Ok I have found the answer. when Anand Singh asked for full error log, I have got the clue. java.lang.OutOfMemoryError: Java heap space then I have found this solution. adding

dexOptions {
        javaMaxHeapSize "2048M"
    }

thanks to Dhruv Android Studio Google JAR file causing GC overhead limit exceeded error

Maybe your libraries are duplicating in dependencies and in libs folder. If you add some .jar file in a libs folder - don't paste its compile 'com.android...' version in build.app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM