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


error:

gradle: execution failed task ':vertretungsplan:dexdebug'. > failed 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;         @ com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:592)         @ com.android.dx.merge.dexmerger.getsortedtypes(dexmerger.java:550)         @ com.android.dx.merge.dexmerger.mergeclassdefs(dexmerger.java:531)         @ com.android.dx.merge.dexmerger.mergedexbuffers(dexmerger.java:168)         @ com.android.dx.merge.dexmerger.merge(dexmerger.java:186)         @ com.android.dx.command.dexer.main.mergelibrarydexbuffers(main.java:300)         @ com.android.dx.command.dexer.main.run(main.java:232)         @ com.android.dx.command.dexer.main.main(main.java:174)         @ com.android.dx.command.main.main(main.java:91) 

project structure:

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     } } 

settings.gradle

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

how can fix error?

the right answer is, of jar files not compile. should go build.gradle file in project, , in dependencies.

if you're importing jar files, try remove them , add them 1 @ time. determine 1 of them causes error.

in case, did that, , when importing last one, app compiled. think real problem was importing many @ once. works.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -