另一个应用程序:dexDebug错误Android Studio

时间:2015-07-14 11:07:01

标签: android android-gradle

我有一个工作项目,现在我想实现一个名为无缝广告网络api的新库。 虽然我在依赖项中添加api并构建它没有任何问题,但我尝试调试应用程序,然后它给出了以下错误。

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

我尝试了类似stackoverflow问题中提到的所有不同的解决方案,但没有运气! 我尝试添加multidexEnabled true但没有工作 我试过添加编译'com.android.support:multidex:1.0.0',但没有工作 我试图注释掉依赖项中提到的其他jar文件但是没有用。这有什么问题?

这是app中的build.gradle

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'
}

这是完整的错误日志

: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

2 个答案:

答案 0 :(得分:2)

好的,我找到了答案。当Anand Singh要求完整的错误日志时,我得到了线索。      java.lang.OutOfMemoryError:Java堆空间 然后我找到了这个解决方案。 添加

dexOptions {
        javaMaxHeapSize "2048M"
    }
感谢Dhruv Android Studio Google JAR file causing GC overhead limit exceeded error

答案 1 :(得分:0)

也许您的库在依赖项 libs 文件夹中重复。如果在libs文件夹中添加一些.jar文件 - 请不要将其compile 'com.android...'版本粘贴到build.app中。