简体   繁体   中英

Android Studio and Dexguard

I am trying to run Dexguard with Android studio. But unable to build the project.

Exception is caused in the line " apply plugin 'dexguard' ".

Exception is Cannot add task ':XXXX:uninstallAll' as a task with that name already exists.

Stacktrace is:

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)

EDIT:

The dexguard plugin itself uses the 'android" plugin. I was also applying the 'android' plugin and it was causing the Exception.

below is the build.gradle file I used for the whole project.

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
    }
}

and I did not get error for the module building when I used dexgard plugin. The module build.gradle file looked like

apply plugin: 'com.android.application'
apply plugin: 'dexguard'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM