我正在尝试使用Gmail库(mail.jar,activation.jar,additional.jar)从我的Android应用发送电子邮件,但我遇到了这个错误:
>Error:Execution failed for task
>':app:transformResourcesWithMergeJavaResForDebug'. >
>com.android.build.api.transform.TransformException:
>com.android.builder.packaging.DuplicateFileException: Duplicate files copied in
> APK META-INF/mimetypes.default
> File1: C:\Users\Deema-chan\Desktop\RPR Programming Tries\RPRok9\app\libs\activation.jar
> File2: C:\Users\Deema-?chan\Desktop\RPR Programming Tries\RPRok9\app\libs\mail.jar
我阅读了有关同一问题的帖子,但提到的大部分解决方案都是添加以下代码行:
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
但没有任何改变,同样的错误仍然存在。关于该怎么做的任何想法?
答案 0 :(得分:0)
你可以在gradle.build中使用这一行
packagingOptions {
pickFirst 'META-INF/license.txt'
}