多个dex文件define-volley

时间:2017-12-28 07:16:51

标签: android

构建apk时出现

错误.... [在此输入图像说明] [1]

错误:任务':app:transformClassesWithDexForDebug'执行失败。

  

com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.dex.DexException:多个dex文件定义Lcom / android /凌空/ VolleyError;

我的朋友:



[XamlCompilation(XamlCompilationOptions.Compile)]




3 个答案:

答案 0 :(得分:2)

解决方案是

 delete "compile 'com.github.bumptech.glide:volley-integration:1.4.0'

答案 1 :(得分:0)

在gradle文件中添加multiDexEnabled true也使用相同版本compile dependencies检查以下代码

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.morten.gpibwal.desakayuambon"
        minSdkVersion 17
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        multiDexEnabled true 

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }
    dexOptions {

    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.volley:volley:1.0.0'
    compile 'com.android.support:cardview-v7:25.0.0'
    compile 'com.android.support:recyclerview-v7:25.0.0'
    compile 'com.github.bumptech.glide:volley-integration:1.4.0'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:25.0.0'
    compile 'com.android.support:design:25.0.0'
    testCompile 'junit:junit:4.12'
}

删除不必要的空

  dexOptions {

        }

答案 2 :(得分:0)

  

com.android.dex.DexException:多个dex文件定义   LCOM /机器人/凌空/ VolleyError;

你应该删除

compile 'com.github.bumptech.glide:volley-integration:1.4.0'

然后 Clean-Rebuild-Run