无法生成签名的apk。重复条目:DragAndDropPermissionsCompat.class

时间:2018-06-11 11:23:00

标签: android gradle

生成已签名的apk时遇到此错误:

  

错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败。   com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / support / v13 / view / DragAndDropPermissionsCompat.class

其中一个参考链接表示更新了依赖项,所以我做了但仍然没有帮助。

我的gradle依赖项如下:

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:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support:design:27.1.0'
compile 'com.google.firebase:firebase-auth:11.6.0'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.android.gms:play-services-auth:11.6.0'
compile 'com.google.android.gms:play-services-places:11.6.0'
compile 'com.google.android.gms:play-services-ads:11.6.0'
compile 'com.google.android.gms:play-services-maps:11.6.0'
compile 'com.google.android.gms:play-services-location:11.6.0'
compile 'agency.tango.android:material-intro-screen:0.0.4'
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.afollestad.material-dialogs:core:0.8.6.1'
compile 'com.afollestad.material-dialogs:commons:0.8.6.1'
compile 'com.tumblr:remember:1.0.0@aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
compile 'com.wang.avi:library:2.1.3'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'com.wdullaer:materialdatetimepicker:3.5.1'
compile 'com.shawnlin:number-picker:2.4.5'
compile 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.2.0'
compile 'com.kofigyan.stateprogressbar:stateprogressbar:0.0.8'
compile 'com.github.jhonnyx2012:horizontal-picker:1.0.6'
compile 'com.zhihu.android:matisse:0.4.3'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
//debugCompile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
testCompile 'junit:junit:4.12'
compile("com.github.hotchemi:permissionsdispatcher:3.2.0") {
    // if you don't use android.app.Fragment you can exclude support for them
    exclude module: "support-v13"
}
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:3.2.0"
}

在我的项目级别gradle我这样做:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'
    classpath 'com.google.gms:google-services:3.1.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    mavenCentral()
    jcenter()
    maven {
        url "https://jitpack.io"
        }
    maven { url "https://maven.google.com" }
}
}

除了link之外,我没有在互联网上找到任何帮助,但仍然没有进展。

2 个答案:

答案 0 :(得分:1)

answer解决了它。 this文章有助于解决错误。

答案 1 :(得分:0)

更新项目级别build.gralde以使用更新的gradle工具:

classpath 'com.android.tools.build:gradle:3.1.2' // or even newer

并删除此

classpath 'com.google.gms:google-services:3.1.0'

最后将您的buildToolsVersion更新为26.0.3

退出Android工作室,清理,重建:)