对于org/intellij/lang/annotations/Identifier.class的TransformException重复条目

roo*_*per 12 android intellij-idea

我收到了这个错误

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: 
duplicate entry: org/intellij/lang/annotations/Identifier.class
Run Code Online (Sandbox Code Playgroud)

它是在我加入compile "com.wefika:flowlayout:0.4.0"我的gradle 之后开始的

这是我的gradle文件

 packagingOptions {
    exclude 'META-INF/NOTICE' // will not include NOTICE file
    exclude 'META-INF/LICENSE' // will not include LICENSE file
    // as noted by @Vishnuvathsan you may also need to include
    // variations on the file name. It depends on your dependencies.
    // Some other common variations on notice and license file names
    exclude 'META-INF/notice'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license'
    exclude 'META-INF/license.txt'
}

dexOptions {
    javaMaxHeapSize "4g"
}




dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'

compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.google.android.gms:play-services-location:9.6.1'
compile "com.google.firebase:firebase-messaging:9.0.0"
compile 'com.google.android.gms:play-services-auth:9.6.1'
compile 'com.google.android.gms:play-services-plus:9.6.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'org.jetbrains:annotations-java5:15.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-core:9.4.0'
compile "com.wefika:flowlayout:0.4.0"

configurations.all {
    resolutionStrategy {
        force 'com.android.support:design:23.4.0'
        force 'com.android.support:support-v4:23.4.0'
        force 'com.android.support:appcompat-v7:23.4.0'
    }
}
Run Code Online (Sandbox Code Playgroud)

Jaw*_*poo 13

在这里看到这个问题,评论提供了解决方案 https://github.com/blazsolar/FlowLayout/issues/31

基本上,您需要将依赖项更改为:

compile ("com.wefika:flowlayout:<version>") {
    exclude group: 'com.intellij', module: 'annotations'
}
Run Code Online (Sandbox Code Playgroud)


Lew*_*wis 5

有冲突吗?

compile 'org.jetbrains:annotations-java5:15.0'
Run Code Online (Sandbox Code Playgroud)

因为它包含与kotlin相同的注释 在此处输入图片说明

就我而言,我将其删除并修复。

希望它能对您有所帮助。

  • 在将 kotlin stdlib 与 *implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"* 集成后恰好遇到它,它将使用 org.jetbrains:annotations:13.0 作为其依赖项(因此这些注释的 2 个版本将冲突) (2认同)