gpt4 book ai didi

Android Studio : Gradle - build fails -- Execution failed for task ':dexDebug'

转载 作者:行者123 更新时间:2023-11-29 20:50:33 25 4
gpt4 key购买 nike

错误:

Gradle: Execution failed for task ':vertretungsplan:dexDebug'.
> Failed to run command:
P:\Android-Studio\sdk\build-tools\18.0.1\dx.bat --dex --output P:\Projekte\VertretungsplanProject\vertretungsplan\build\libs\vertretungsplan-debug.dex P:\Projekte\VertretungsplanProject\vertretungsplan\build\classes\debug P:\Projekte\VertretungsplanProject\vertretungsplan\build\dependency-cache\debug P:\Android-Studio\sdk\extras\android\m2repository\com\android\support\support-v4\18.0.0\support-v4-18.0.0.jar P:\Projekte\VertretungsplanProject\vertretungsplan\libs\commons-io-2.4.jar P:\Projekte\VertretungsplanProject\vertretungsplan\build\exploded-bundles\VertretungsplanProjectLibrariesActionbarsherlockUnspecified.aar\classes.jar
Error Code:
2
Output:
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing de/MayerhoferSimon/Vertretungsplan/LoginActivity$2.class
...while processing de/MayerhoferSimon/Vertretungsplan/LoginActivity$2.class
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing de/MayerhoferSimon/Vertretungsplan/MainActivity$1.class
...while processing de/MayerhoferSimon/Vertretungsplan/MainActivity$1.class
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing de/MayerhoferSimon/Vertretungsplan/YQL/YqlVplanParser.class
...while processing de/MayerhoferSimon/Vertretungsplan/YQL/YqlVplanParser.class
3 warnings
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.util.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:592)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:550)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:531)
at com.android.dx.merge.DexMerger.mergeDexBuffers(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:186)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:300)
at com.android.dx.command.dexer.Main.run(Main.java:232)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)

项目结构:

enter image description here

build.gradle(actionbarsherlock)

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android-library'

dependencies {
compile 'com.android.support:support-v4:18.0.0'
}

android {
compileSdkVersion 18
buildToolsVersion "18.0.1"

defaultConfig {
minSdkVersion 8
targetSdkVersion 11
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}

build.gradle(vertretungsplan)

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'

dependencies {
compile files('libs/commons-io-2.4.jar')
compile project(':libraries:actionbarsherlock')
}

android {
compileSdkVersion 18
buildToolsVersion "18.0.1"

defaultConfig {
minSdkVersion 8
targetSdkVersion 11
}
}

设置.gradle

include ':vertretungsplan', ':libraries:actionbarsherlock'

如何修复此错误?

最佳答案

正确的答案是,您的某些 jar 文件无法编译。您应该进入项目中的 build.gradle 文件,并查看依赖项。

如果您只是导入一些 jar 文件,您可以尝试删除它们并一次添加一个。这将帮助您确定其中哪一个导致了错误。

就我而言,我就是这样做的,当我导入最后一个时,应用程序编译了。所以我认为真正的问题是我一次导入了太多。但现在一切正常了。

关于Android Studio : Gradle - build fails -- Execution failed for task ':dexDebug' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38094998/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com