2

I am trying to add Dexguard to Android Studio. I have followed the guidelines so my build.gradle is the following:

buildscript {
    repositories {
        mavenCentral()
        flatDir { dirs '/Users/XXXX/Desktop/DexGuard5.3.00/lib' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.4'
        classpath ':dexguard:'
    }
}

apply plugin: 'dexguard'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        debug {
            proguardFile plugin.getDefaultDexGuardFile('dexguard-debug.pro')
            proguardFile 'dexguard-project.txt'
            proguardFile 'proguard-project.txt'
        }
        release {
            proguardFile plugin.getDefaultDexGuardFile('dexguard-release.pro')
            proguardFile 'dexguard-project.txt'
            proguardFile 'proguard-project.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.0.1'
    compile 'com.android.support:appcompat-v7:19.0.1'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

Then I try to build the project and I get the following error:

Error:A problem occurred configuring project ':XXXX'. No such property: baseName for class: com.android.build.gradle.internal.variant.ApplicationVariantData

Has anyone experienced such problem again?

Thank you in advance!

JJD
  • 50,076
  • 60
  • 203
  • 339
Dimitris Makris
  • 5,183
  • 2
  • 34
  • 54

2 Answers2

1

The Gradle plugin for DexGuard 5.3.00 is compatible with the Android plugin 0.5.1, so you should adapt the class path at the top of the file.

You probably want to install the latest version of the Gradle plugin though. At this time of writing, the Gradle plugin for DexGuard 5.5 is compatible with the Android plugin 0.9.0.

As a reference, you can always find working sample projects with build files in DexGuard's samples directory.

Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106
0

First you can try to add nexusUsername=123 nexusPassword=123 in the "project/maven_push.gradle"

Then if it report "Error:Could not find property 'allJava' on source set main."

you can try this:

task androidJavadocs(type: Javadoc) {  
    //  comment it if you find
    //source = android.sourceSets.main.allJava  
}  

task androidJavadocsJar(type: Jar) {  
    classifier = 'javadoc'  
    //basename = artifact_id  
    // comment it if you find
    //from android.sourceSets.main.allSource  
}  

task androidSourcesJar(type: Jar) {  
    classifier = 'sources'  
    //basename = artifact_id  
    ////comment it if you find 
    //from android.sourceSets.main.allSource  
}  

Last it‘s not my answer ,I found it in an small blog~~~Thanks to the authoer ,it sloved my problems~ Good luck to you ~

windpush
  • 9
  • 3