在我的项目中,我使用jackson-core-asl-1.9.7.jar和jackson-mapper-asl-1.9.7.jar库。在android studio中运行应用程序后,我遇到了这个错误:
Error:Execution failed for task ':transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/ASL2.0
File1: F:\Projects\Cordova\AdapterProject\platforms\android\libs\jackson-core-asl-1.9.7.jar
File2: F:\Projects\Cordova\AdapterProject\platforms\android\libs\jackson-mapper-asl-1.9.7.jar
我的代码:
CordovaLib:
packagingOptions {
exclude 'libs/jackson-core-asl-1.9.7.jar'
exclude 'libs/jackson-mapper-asl-1.9.7.jar'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
和 的build.gradle:
packagingOptions {
exclude 'libs/jackson-core-asl-1.9.7.jar'
exclude 'libs/jackson-mapper-asl-1.9.7.jar'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
如何解决问题
注意:我在android Project(不是cordova)中使用这些库,但是它有效并且我没有问题。
答案 0 :(得分:1)
cordova 1.x.x当我处理Phone gap应用程序时使用的任何版本库,所以我认为,如果你正在处理手机间隙,那么有必要在你的项目中导入文件,否则忽略这个库 所以错误可能是因为CASE -SENSITIVE 所以从packagingOptions
中删除这个NOTICE.txt