Android Studio报错:Error:duplicate files during packaging of APK


 转载请注明出处:

具体错误描述:

    

Error:duplicate files during packaging of APK F:\android_studio_project\nizaoma\app\build\outputs\apk\app-debug-unaligned.apk
    Path in archive: META-INF/NOTICE.txt
    Origin 1: F:\android_studio_project\nizaoma\app\libs\httpmime-4.2.4.jar
    Origin 2: F:\android_studio_project\nizaoma\app\libs\fastjson.jar
You can ignore those files in your build.gradle:
    android {
      packagingOptions {
        exclude 'META-INF/NOTICE.txt'
      }
    }
 原因:
 是因为你的项目的两个以上的jar包包含 NOTICE.txt 文件:

    Android Studio报错:Error:duplicate files during packaging of APK_第1张图片
  解决办法:
  在build.grade 中增加:
android { packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' } }


你可能感兴趣的:(android,androidstudio)