我是第一次在Android Studio中使用改造。我正面临以下问题。
我也尝试了无效并重新启动,清理项目,但问题没有解决。
我也尝试删除File2,但是它是在运行项目后创建的。
作为一种解决方案,建议在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'
}
构建错误
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/maven/com.squareup.retrofit2/retrofit/pom.xml
File1: E:\AndroidStudioProjects\RetrofitEx\app\libs\retrofit-2.0.1.jar
File2: C:\Users\deepak\.gradle\caches\modules-2\files-2.1\com.squareup.retrofit2\retrofit\2.0.1\27293c440d2085cde1d859528aff6e7d3b6ae40\retrofit-2.0.1.jar
最佳答案
packagingOptions{
pickFirst 'META-INF/maven/com.squareup.retrofit2/retrofit/pom.xml'
pickFirst 'META-INF/maven/com.squareup.retrofit2/retrofit/pom.properties'
}
希望有帮助。
关于android - 在android中构建失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36508718/