Android Gradle plugin 0.7.0: “duplicate files during packaging of APK”

后端 未结 20 2929
谎友^
谎友^ 2020-11-22 08:51

Using Android Gradle plugin 0.7.0 with the following build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }

    dependenci         


        
20条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 09:16

    The problem is that the META-INF folder won't get filtered so multiple entries of NOTICE or LICENSE cause duplicates when building and it is tryed to copy them together.

    Dirty Quick Fix:

    Open the .jar file in your .gradle/caches/... folder (with a zip compatible tool) and remove or rename the files in the META-INF folder that cause the error (usally NOTICE or LICENSE). (I know thats also in the OP, but for me it was not really clear until I read the google forum)

    EDIT:

    This was fixed in 0.7.1. Just add the confilcting files to exclude.

    android {
        packagingOptions {
            exclude 'META-INF/LICENSE'
        }
    }
    

提交回复
热议问题