【问题标题】:duplicate entry: com/android/volley/Request$Priority.class重复条目:com/android/volley/Request$Priority.class
【发布时间】:2018-01-20 01:13:03
【问题描述】:

我尝试了很多解决方案,但它们都不适合我 当我尝试生成应用文件时遇到此错误:

错误:任务 ':app:transformClassesWithJarMergingForRelease' 执行失败。 com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/android/volley/Request$Priority.class

这是我的毕业作品:

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

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.0.0'  //volley http request library
compile 'com.nightonke:boommenu:2.1.0'            //navigation view
compile 'com.baoyz.pullrefreshlayout:library:1.2.0'            //refresh layout
compile 'com.github.medyo:fancybuttons:1.8.3'     //custom button
compile 'com.rengwuxian.materialedittext:library:2.1.4' //custom edittext
compile 'com.jaredrummler:material-spinner:1.1.0' //custom spinner
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.0' // progressbar button
compile 'com.alimuzaffar.lib:pinentryedittext:1.3.1'  //pin entry edit text
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.zarinpal:purchase:0.0.3-beta' 
compile 'com.android.support:multidex:1.0.1'

compile ('com.github.ganfra:material-spinner:1.1.1'){
    exclude group: 'com.nineoldandroids', module: 'library'
    exclude group: 'com.android.support', module: 'appcompat-v7'
}

testCompile 'junit:junit:4.12'

}

【问题讨论】:

  • libs 中是否有任何 JAR?如果有,它们是什么?
  • @CommonsWare 不,我不
  • @JoshuaDrake 很遗憾我在那里找不到解决方案
  • 我遇到了同样的问题,我刚刚在zarinpals git 中打开了问题。他们在他们的库中使用了 volley,这不是原始的“volley”。你找到解决办法了吗?

标签: android


【解决方案1】:

我在 Jenkins 上构建时遇到了类似的问题,奇怪的是它在我的本地机器上运行良好。添加以下排除后,它可以在本地机器和 Jenkins 上运行。

android{
   configurations {
   all*.exclude group: 'com.android.volley'
   }
}

我已将配置块添加到我的应用程序的 build.gradle inside android 部分。

如果重要的是编译 SDK 版本是 22,构建工具版本是 25.0.0

这就像一个魅力。

【讨论】:

    【解决方案2】:

    我为每一个使用“zarinpal”的人写下这个答案。 你应该像这样从“zarinpal 库中排除 volley 库:

    compile ('com.zarinpal:purchase:0.0.3-beta'){
            exclude group: 'com.mcxiaoke.volley', module: 'library'
        } //zarinpal api 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多