2016-08-25 36 views
0

我试图建立我的Android Studio中的应用程序的发布版本,不管我怎么努力,我得到错误信息:变换抛出异常,即使multidexEnabled

执行失败的任务 “应用程序: transformClassesWithJarMergingForRelease”。 > com.android.build.api.transform.TransformException: java.util.zip.ZipException:重复条目: com/android/volley/Request $ Priority.class。

我启用了multidex,清理并重建了我的应用程序,没有任何工作。 以下是我的gradle这个编译:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "carter.streakly" 
     minSdkVersion 19 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 

     multiDexEnabled true 
    } 

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

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.0.0' 
    compile 'com.android.support:design:24.0.0' 
    compile 'com.google.android.gms:play-services-appindexing:8.1.0' 
    compile 'com.google.android.gms:play-services:9.2.1' 
    compile 'com.mcxiaoke.volley:library-aar:1.0.0' 
    compile 'com.android.volley:volley:1.0.0' 
    compile 'org.jetbrains:annotations-java5:15.0' 
    compile 'com.android.support:support-v4:24.0.0' 
    compile 'com.android.support:multidex:1.0.0' 
} 
+0

可能是重复的。尝试执行此操作:http://stackoverflow.com/questions/33209631/errorexecution-failed-for-task-apptransformclasseswithjarmergingfordebug –

回答

0

build.gradle依赖你包括两个库:

compile 'com.mcxiaoke.volley:library-aar:1.0.0' 
compile 'com.android.volley:volley:1.0.0' 

其中com.mcxiaoke.volley基本上是谷歌官方图书馆的一个分支,所以你应该只使用其中的一个。还请注意,根据​​READ.ME

(...)这个项目已被弃用,不再被维护,请使用正式版从jCenter。

compile 'com.android.volley:volley:1.0.0'