Android Studio模拟器错误 – 以非零退出值2结束

前端之家收集整理的这篇文章主要介绍了Android Studio模拟器错误 – 以非零退出值2结束前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
所以我有一个应用程序,我一直在开发/测试一下,并没有任何问题,将它加载到我的手机上进行调试.有一天不知从哪里开始投掷和错误,不会再让我运行模拟器了.错误如下:
* What went wrong:
Execution Failed for task ':app:dexDebug'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘C:\Program Files\Java\jdk1.7.0_75\bin\java.exe” finished with non-zero exit value 2

gradle控制台输出以下错误

AGPBI: {"kind":"SIMPLE","text":"UNEXPECTED TOP-LEVEL EXCEPTION:","position":           {},"original":"UNEXPECTED TOP-LEVEL EXCEPTION:"}
AGPBI: {"kind":"SIMPLE","text":"com.android.dex.DexException: Multiple dex   files define Lbolts/AggregateException;","position":  {},"original":"com.android.dex.DexException: Multiple dex files define    Lbolts/AggregateException;"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)","position"     :{},"original":"\tat  com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)","position": {},"original":"\tat   com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)","position":{},"original":"\tat com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)","original":"\tat com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.merge.DexMerger.merge(DexMerger.java:189)","original":"\tat com.android.dx.merge.DexMerger.merge(DexMerger.java:189)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)","original":"\tat com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)","original":"\tat com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.run(Main.java:246)","original":"\tat com.android.dx.command.dexer.Main.run(Main.java:246)"}
AGPBI: {"kind":"SIMPLE","text":"\tat  com.android.dx.command.dexer.Main.main(Main.java:215)","original":"\tat com.android.dx.command.dexer.Main.main(Main.java:215)"}
AGPBI: {"kind":"SIMPLE","text":"\tat   com.android.dx.command.Main.main(Main.java:106)","original":"\tat   com.android.dx.command.Main.main(Main.java:106)"}

我在SO和谷歌的几个案例中搜索了这个确切的错误,但这些解决方案似乎都没有.我也在下面附上了我的build.gralde文件.

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.0"

defaultConfig {
    applicationId "****"
    minSdkVersion 11
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs',include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs',include: 'Parse-*.jar')

谁能在这里给我一点帮助?

解决方法

在我的情况下,通过清理项目并从build.gradle中的依赖项中删除一些未使用的库来解决问题.

如果您必须保留库,则可以通过添加默认配置来启用multi dex.

defaultConfig 
{        
    // Enabling multidex support.

    multiDexEnabled true
}
原文链接:https://www.f2er.com/android/314591.html

猜你在找的Android相关文章