奇怪的Gradle错误

时间:2014-07-09 20:55:15

标签: android gradle

当我升级到8.2时,我的Gradle随机停止工作。我以前一直在使用8.1,它运行良好。我已经注意到这是一个问题,因为它不会启动LogCat。这是gradle

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '20.0.0'
    defaultConfig {
        applicationId 'com.Hype.Hype'
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/java/Location/'] } }
productFlavors {
}
}

dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.google.android.gms:play-services:5.0.77'
compile 'com.android.support:appcompat-v7:19.+'

compile 'com.android.support:support-v4:20.0.0'
}

并且出现了错误:

Error:Execution failed for task ':Hype:dexDebug'.
  

com.android.ide.common.internal.LoggedErrorException:无法运行命令:       /opt/android-studio/sdk/build-tools/android-4.4W/dx --dex --num-threads = 4 --output / opt / Hype / Hype / build / intermediates / dex / debug / opt / Hype / Hype / build / intermediates / classes / debug / opt / Hype / Hype / build / intermediates / dependency-cache / debug /opt/Hype/Hype/build/intermediates/pre-dexed/debug/support-v4-19.1.0 -bfe6379f31d17615f5ca4b83bd0a7235fba0720f.jar /opt/Hype/Hype/build/intermediates/pre-dexed/debug/support-annotations-20.0.0-ac9eecc253fdba2831c82bc0dc80fba11be63671.jar / opt / Hype / Hype / build / intermediates / pre-dexed / debug / internal_impl -20.0.0-b0cd61d02fc324aa2a414aecfa6fa63d5d33a68e.jar /opt/Hype/Hype/build/intermediates/pre-dexed/debug/classes-514200de11abcc130af4614a253468bb032131c5.jar / opt / Hype / Hype / build / intermediates / pre-dexed / debug / classes-fa2bce017d882684ab53055a2592668973f2d854 .jar /opt/Hype/Hype/build/intermediates/pre-dexed/debug/classes-b7bd0b7cbec94a8ac53e5fa6e712a05b7a389bdb.jar / opt / Hype / Hype / build / intermediates / pre-dexed / debug / classes-0a4e6130fc95f4fb54dd696e45fe3207f155c4f2 。罐     错误代码:       2     输出:       意外的顶级例外情况:       com.android.dex.DexException:多个dex文件定义了Landroid / support / v4 / accessibilityservice / AccessibilityServiceInfoCompatIcs;           在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)           在com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)           在com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)           在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)           在com.android.dx.merge.DexMerger.merge(DexMerger.java:188)           在com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)           在com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)           在com.android.dx.command.dexer.Main.run(Main.java:230)           在com.android.dx.command.dexer.Main.main(Main.java:199)           在com.android.dx.command.Main.main(Main.java:103)

1 个答案:

答案 0 :(得分:9)

看起来你包括两次相同的东西。检查libs/您是否拥有支持库jar。