繁体   English   中英

任务':app:dexDebug'的执行失败,错误代码:1

[英]Execution failed for task ':app:dexDebug' Error Code:1

嘿,我对使用android-studio在Android上进行开发非常陌生。

我添加了一个onClick并最终出现此错误:

FAILURE: Build failed with an exception.

* What went wrong:Execution failed for task ':app:dexDebug'.

com.android.ide.common.internal.LoggedErrorException:无法运行命令:/Users/home/Library/Android/sdk/build-tools/21.1.2/dx --dex --no-optimize --output / Users / home / Documents / **** / Android / MyApp / app / build / intermediates / dex / debug --input-list = / Users / home / Documents / **** / Android / MyApp / app / build / intermediates /tmp/dex/debug/inputList.txt错误代码:1

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

我尝试删除一些依赖项,重新安装并更新了所有内容,但仍然无法正常工作。

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "myapp.com.example.home.myapplication"
    minSdkVersion 15
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
  //  compile 'com.android.support:support-annotations:21.0.+'
}

发生这种情况是因为您不能有重复的类。

您必须检查自己的生成,生成的源代码和项目,以便您不只一次包含一个

同样,同一lib的不同版本也可能导致错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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