【问题标题】:Error:Execution failed for task ':app:dexDebug'... using android studio错误:任务':app:dexDebug'的执行失败......使用android studio
【发布时间】:2015-10-03 22:24:24
【问题描述】:

我正在使用这个库https://github.com/mikepenz/MaterialDrawer

当我尝试运行我的项目时,我收到以下错误:

错误:

错误:任务 ':app:dexDebug' 执行失败。 com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:进程'命令 '/库/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/bin/java'' 以非零退出值 2 结束

如果我尝试使用 jdk1.7

错误:任务 ':app:dexDebug' 执行失败。 com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:进程'命令 'C:\Program Files\Java\jdk1.7.0_45\bin\java.exe'' 完成 非零退出值 2

这是我的 build.gradle

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

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

repositories {
maven { url 'https://maven.fabric.io/public' }
}

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.test"
    minSdkVersion 14
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

productFlavors {
}


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:22.1.1'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.mcxiaoke.volley:library:1.0.+'

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

compile 'com.afollestad:material-dialogs:0.7.6.0'    
compile 'com.blunderer:materialdesignlibrary:2.0.0'     
compile 'com.github.navasmdc:MaterialDesign:1.5@aar'    


//https://github.com/mikepenz
compile('com.mikepenz:materialdrawer:3.1.2@aar') {
    transitive = true
} 
compile('com.mikepenz:aboutlibraries:5.0.7@aar') {
    transitive = true
}


compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
    transitive = true;
}
}

我也尝试了这些解决方案,但它不起作用:

defaultConfig {
        ...
        multiDexEnabled = true
    }

dependencies {

...
    compile 'com.android.tools.build:gradle:1.1.2'   
...
}

【问题讨论】:

    标签: java android android-studio android-gradle-plugin material-design


    【解决方案1】:

    您的问题应该通过指定来解决 -

    defaultConfig {        
        // Enabling multidex support.
        multiDexEnabled true
    }
    

    您可以在65K Method Limit阅读更多信息

    【讨论】:

      猜你喜欢
      • 2016-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-13
      • 2015-05-16
      相关资源
      最近更新 更多