我正在尝试使用Android工作室运行Dexguard。但无法建立项目。
行“apply plugin 'dexguard'
”中导致异常。
例外是Cannot add task ':XXXX:uninstallAll' as a task with that name already exists.
Stacktrace是:
Caused by: org.gradle.api.InvalidUserDataException: Cannot add task ':XXXX:uninstallAll' as a task with that name already exists.
at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:60)
at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:94)
at org.gradle.api.tasks.TaskContainer$create$0.call(Unknown Source)
at com.android.build.gradle.BasePlugin.apply(BasePlugin.groovy:195)
at com.android.build.gradle.AppPlugin.super$2$apply(AppPlugin.groovy)
at com.android.build.gradle.AppPlugin.apply(AppPlugin.groovy:80)
at com.saikoa.dexguard.g.super$3$apply(DexGuard)
at com.saikoa.dexguard.g.apply(DexGuard:61)
at com.saikoa.dexguard.g.apply(DexGuard)
编辑:
dexguard插件本身使用'android'插件。我也在应用'android'插件,它导致异常。
答案 0 :(得分:0)
是我用于整个项目的build.gradle文件。
buildscript {
repositories {
jcenter()
flatDir { dirs 'C:\\DexGuard\\lib'}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath ':dexguard:'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
当我使用dexgard插件时,我没有得到模块构建的错误。模块build.gradle文件看起来像
apply plugin: 'com.android.application'
apply plugin: 'dexguard'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"