安卓Duplicate files copied in APK META-INF/LICENSE
阿新 • • 發佈:2018-11-01
Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
File1: E:\idea\MyApplication\android\libs\jackson-annotations-2.2.3.jar
File2: E:\idea\MyApplication\android\libs\jackson-core-2.2.3.jar
File3: E:\idea\MyApplication\android\libs\jackson-databind-2.2.3.jar
這是由於jar包中引入類有衝突引起的解決方法 為在build.gradle中加入這一段程式碼
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}