Android Studio中的异常构建错误?

时间:2015-01-07 15:05:05

标签: android performance android-activity android-studio

我编译了我的代码并收到了这个错误:

Error:Execution failed for task ':iMSDroid:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Users\pardeep.sharma\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output D:\Android\Android_Workspace\imsdroid\iMSDroid\build\intermediates\dex\debug --input-list=D:\Android\Android_Workspace\imsdroid\iMSDroid\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
    2
Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lorg/doubango/ngn/NgnApplication;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
        at com.android.dx.command.dexer.Main.run(Main.java:246)
        at com.android.dx.command.dexer.Main.main(Main.java:215)
        at com.android.dx.command.Main.main(Main.java:106)

我的Build.Gradle文件包含以下内容

// Top-level build file where you can add configuration options common to all sub-

projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

我已经从评论和正确的SDK安装路径中删除了一些特殊字符,但没有运气。请查看是否存在异常情况。

更新:

Imsdroid Build.gradle文件代码:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "org.doubango.imsdroid"
        minSdkVersion 7
        targetSdkVersion 11
    }

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

dependencies {
    compile project(':androidngnstack')
}

0 个答案:

没有答案