重复文件,同时包括与刀补刀 [英] Duplicate files while including butterknife with gradle
本文介绍了重复文件,同时包括与刀补刀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Android Studio创建了一个基本的Android应用程序,并且在向我的构建中添加butterknife时遇到问题。我得到这个错误:
错误::在APK C:\apps\orion\app\\包装过程中出现重复文件\\ build \apk\app-debug-unaligned.apk
错误:任务':app:packageDebug'的执行失败。
>在APK META-INF / services / javax.annotation.processing.Processor中复制的重复文件
文件1:C:\ Users \\\\\\\\\\\\\\\\\\\\\\ \com.jakewharton\butterknife\4.0.1\f43b36925363701633d01adb8e54df7150397a78\butterknife-4.0.1.jar
文件2:C:\ Users \andres\.gradle\caches\modules -2 \files-2.1\com.jakewharton\butterknife\4.0.1\f43b36925363701633d01adb8e54df7150397a78\butterknife-4.0.1.jar
我的依赖关系如下所示:
依赖关系{
compile'com.android.support:support-v4:+'
compile'com.squareup.dagger:dagger-compiler:1.2.1'
compile'com.squareup.dagger:dagger:1.2 .1'
compile'com.jakewharton:butterknife:4.0.1'
compile'com.google.android.gms:play-services:4.0.30'
compile'com.android .support:appcompat-v7:+'
编译项目(':lib')
编译fileTree(dir:'libs',include:['* .jar'])
}
解决方案插件的更新版本会告诉你如何解决这个问题。我认为我们在0.8中引入了修复程序,因此您应该升级。然后修复就是把它放在你的
build.gradle中
android {
pre>
packagingOptions {
不包括'META-INF / services / javax.annotation.processing.Processor'
}
}
这会将该文件从包装中排除,因为在APK中实际上不需要它。
I have a basic Android app that I created with Android Studio, and I'm having problems adding butterknife to my build. I get this error:
Error:: duplicate files during packaging of APK C:\apps\orion\app\build\apk\app-debug-unaligned.apk Error:Execution failed for task ':app:packageDebug'. > Duplicate files copied in APK META-INF/services/javax.annotation.processing.Processor File 1: C:\Users\andres\.gradle\caches\modules-2\files-2.1\com.jakewharton\butterknife\4.0.1\f43b36925363701633d01adb8e54df7150397a78\butterknife-4.0.1.jar File 2: C:\Users\andres\.gradle\caches\modules-2\files-2.1\com.jakewharton\butterknife\4.0.1\f43b36925363701633d01adb8e54df7150397a78\butterknife-4.0.1.jar
My dependencies look like this:
dependencies { compile 'com.android.support:support-v4:+' compile 'com.squareup.dagger:dagger-compiler:1.2.1' compile 'com.squareup.dagger:dagger:1.2.1' compile 'com.jakewharton:butterknife:4.0.1' compile 'com.google.android.gms:play-services:4.0.30' compile 'com.android.support:appcompat-v7:+' compile project(':lib') compile fileTree(dir: 'libs', include: ['*.jar']) }
解决方案Later versions of the plugin will tell you how to fix this. I think we introduced the fix in 0.8 so you should probably upgrade. Then the fix is to put this in your
build.gradle
android { packagingOptions { exclude 'META-INF/services/javax.annotation.processing.Processor' } }
This will exclude this file from the packaging which is fine since it's not actually needed in the APK.
这篇关于重复文件,同时包括与刀补刀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文