在两个官方android库中重复类,gradle失败
我使用的库需要激活渲染脚本支持模式。像这样在两个官方android库中重复类,gradle失败,android,annotations,android-gradle-plugin,render,libs,Android,Annotations,Android Gradle Plugin,Render,Libs,我使用的库需要激活渲染脚本支持模式。像这样 defaultConfig { minSdkVersion 14 targetSdkVersion 23 renderscriptTargetApi 20 renderscriptSupportModeEnabled true } 但当我尝试运行该应用程序时,我发现: Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. java.util.zip
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
renderscriptTargetApi 20
renderscriptSupportModeEnabled true
}
但当我尝试运行该应用程序时,我发现:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: android/support/annotation
/Keep.class
Keep.class位于注释支持库和
rendservscript
lib中,两者都来自谷歌,所以我不知道该怎么做。此错误仅发生在最新(23)SDK版本中。您是否可以尝试将构建版本更改为22或21,同时更改依赖项
例如
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
}
我对build.gradle文件进行了以下修改,现在可以正常工作了:
renderScriptTargetApi 23
并补充说
configurations{all*.exclude group:'com.android.support',module:'support annotations'}
我相信这是第二行成功了。在谷歌修复之前,这似乎是唯一的选择。谢谢。我不确定这是否是现在最好的方法。我知道这可能有效,不包括lib,但我不能失去支持注释。无论如何,谢谢你。