2

我正在使用一个需要激活渲染脚本支持模式的库。像这样

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 在 annotation-support lib 和rendserscriptlib 中,都来自 Google,所以我不知道该怎么做。

4

2 回答 2

1

此错误仅在最新 (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'  
}
于 2015-09-01T09:10:56.307 回答
0

我对我的 build.gradle 文件进行了以下修改,它现在可以工作了:

renderScriptTargetApi 23

并添加

configurations { all*.exclude group: 'com.android.support', module: 'support-annotations' }

我相信这是第二行成功了。

于 2015-09-01T17:00:09.827 回答