Android Studio Execution failed task: app: preDexDebug '

This strange behavior is happening with my build application.

The weird thing is that this com.nineoldandroids is a jar of Android resource libraries.

I tried removing the build source and recompiling again with no luck.

My buildgradle:

buildscript {
    repositories {
        maven { url 'http://download.crashlytics.com/maven' }
    }

    dependencies {
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'

repositories {
    maven { url 'http://download.crashlytics.com/maven' }
}

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    defaultConfig {
        applicationId "xxxxxxxx"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            // enable crashlytics where you need
            buildConfigField "boolean", "USE_CRASHLYTICS", "false"
            ext.enableCrashlytics = false
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':library_refreshaction_appcompat')
    compile project(':EnhancedListView')
    compile project(':library_numberpicker')
    compile project(':materialDesign')
    compile project(':library_typeface')
    compile project(':library_updatechecker')
    compile 'com.android.support:appcompat-v7:21.0.0'
    compile 'com.android.support:support-v4:21.0.0'
    compile 'com.crashlytics.android:crashlytics:1.+'
    compile 'se.emilsjolander:stickylistheaders:2.5.0'
    compile files('libs/Parse-1.7.1.jar')
    compile files('libs/BixolonPrinter.jar')
    compile files('libs/bolts-android-1.1.3.jar')
    compile files('libs/core-3.1.0.jar')
    compile files('libs/gson-2.2.4.jar')
    compile files('libs/universal-image-loader-1.9.2.jar')
    compile files('libs/VposAPI.jar')
    compile project(':android-support-v4-preferencefragment-master')
}

      

Error log:

Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Users/Marcus/Downloads/adt-bundle-mac-x86_64-20140702/sdk/build-tools/21.0.2/dx --dex --output /Users/Marcus/Workspace/android-pdv/app/build/intermediates/pre-dexed/debug/library-2.4.0-c0bb3fabf202a58f481b22d99eb3ba9b89fd232d.jar /Users/Marcus/.gradle/caches/modules-2/files-2.1/com.nineoldandroids/library/2.4.0/e9b63380f3a242dbdbf103a2355ad7e43bad17cb/library-2.4.0.jar
  Error Code:
    139

      

+3


source to share


3 answers


As related to @zapl Unable to build Android project using Android Studio - Gradle 1.7 , this is strange behavior that has only one way to solve it, as related to this post.

I couldn't say exactly what I did to solve this because I tried a lot of things until it disappeared.

But as the post said, this is the way:



  • Invalid resources (Missing attributes, invalid tags, etc.)
  • + id in styles
  • Duplicated resources / libraries
  • Invalid Declare-Style Name
  • Invalid resource resource, try different versions of AAPT.

Unknown, like mine. So it would be helpful:

  • Find a way to determine the real cause of this error.
  • Wait for AAPT update that returns an error
  • Enter a list of possible common causes.
+5


source


I had the same problem and it was fixed by simply restarting Android Studio.



I can only guess the reason, but I think it happened because I launched the application while my emulator was still loading.

+2


source


It looks like you have build tools 21.0.2 installed, but you are using 20.0.0 in your gradle buildTootlsVersion Also you have defined repositories

twice and you only need it in the first gradle block.

Try changing your build toolkit version.

0


source







All Articles