【问题标题】:TransformException: java.util.zip.ZipException: duplicate entry: com/activeandroid/ActiveAndroid.classTransformException:java.util.zip.ZipException:重复条目:com/activeandroid/ActiveAndroid.class
【发布时间】:2017-03-15 04:03:22
【问题描述】:

请让我知道这里到底需要什么,我可以看到相同的源在 Android Studio 模拟器中运行良好,但在 bluestacks 等第三方模拟器中我可以看到以下错误。

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/activeandroid/ActiveAndroid.class

请在此处检查我的 gradle 依赖项。

dependencies {
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile files('library/android-viewbadger.jar')
compile files('library/robobinding-0.8.1.jar')
compile files('library/activeandroid-3.1-SNAPSHOT.jar')
compile project(':Android-Validator')

// 编译文件('library/java-rt-jar-stubs-1.5.0.jar') }

dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.0.1'
compile ('com.android.support:appcompat-v7:25.0.1'){
    exclude module: 'support-v4'
}
compile 'com.viewpagerindicator:library:2.4.1@aar'
compile 'com.f2prateek.progressbutton:progressbutton:2.1.0@aar'
compile files('library/afreechart-0.0.4.jar')
compile 'commons-io:commons-io:+'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.google.guava:guava:16+'
compile 'joda-time:joda-time:2.9.4'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'com.sun.codemodel:codemodel:2.4.1'
compile 'org.apache.httpcomponents:httpmime:4.5.1'
compile 'ch.acra:acra:4.9.0'
compile 'org.jsoup:jsoup:1.10.2'
compile 'org.apache.commons:commons-lang3:3.4'
compile ('org.simpleframework:simple-xml:2.7.1'){
    exclude module: 'stax'
    exclude module: 'stax-api'
    exclude module: 'xpp3'
}
compile files('library/pdfjet-5.75.jar')
compile 'log4j:log4j:1.2.17'
compile 'com.splunk:mint-android-sdk:5.2.1'
compile 'de.mindpipe.android:android-logging-log4j:1.0.3'
compile files('library/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar')
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'

}

【问题讨论】:

  • 你试过清理你的项目吗?
  • 是的,我尝试了清理选项以及无效缓存并重新启动,我只在第三方模拟器中遇到这个问题,本机模拟器应用程序很好。

标签: android android-studio android-gradle-plugin build.gradle


【解决方案1】:

这个问题通常是在 gradle 中添加两次相同的类时出现的。 为什么要使用

compile files('library/activeandroid-3.1-SNAPSHOT.jar')

compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'

这就是原因。尝试只添加一次,然后构建 gradle 并运行

【讨论】:

  • 感谢@Android Geek 指出这一点,但是通过从依赖项中删除activeandroid-3.1-SNAPSHOT.jar、清理缓存和清理构建,我可以看到错误:java.lang.OutOfMemoryError:GC 开销限制超出错误。但如果我同时使用 activeandroid,我可以在模拟器中运行应用程序,但不能在 BlueStacks 中运行。所以我有点困惑这是怎么发生的。
猜你喜欢
  • 1970-01-01
  • 2018-07-22
  • 2016-06-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多