Java2API';s原因:在APK中复制了重复的文件
所以,我的问题是joda time和JavaMail API之间的冲突Java2API';s原因:在APK中复制了重复的文件,java,android,api,android-gradle-plugin,Java,Android,Api,Android Gradle Plugin,所以,我的问题是joda time和JavaMail API之间的冲突 Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate file
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/LICENSE.txt
File1: C:\Users\sdilab\.gradle\caches\modules-2\files-2.1\
joda-time\joda-time\2.4\89e9725439adffbbd41c5f5c215c136082b34a7f\
joda-time-2.4.jar
File2: C:\Users\sdilab\.gradle\caches\modules-2\
files-2.1\com.sun.mail\android-mail\1.5.5\
53a2f927b235acb565dbe9314ececfb7e6d43020\android-mail-1.5.5.jar
上面的日志说我有两个同名文件,这些文件来自API
如何解决此问题?排除META-INF/LICENSE.txt文件。在您的
build.gradle中
:
android {
//more things
packagingOptions {
exclude 'META-INF/LICENSE.txt'
//more things
}
}
排除META-INF/LICENSE.txt
android{packagingOptions{Exclude'META-INF/LICENSE.txt'}
想回答这个问题吗?你解决了问题。太好了,我已经发布了答案;)