1

I am getting gradle build error:

Error: Cannot get property 'dirName' on null object

I get this error with gradle version 1.3.1 or greater.

When I use gradle version 1.2.3 there is no error.

I google this error but was not able to find any solution. Please help!

My project gradle file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven"  }
        mavenCentral()
        jcenter()
        flatDir { dirs '/usr/local/DexGuard6.1.19/lib' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath ':dexguard:'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    } 
}

allprojects {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://jitpack.io" }
        mavenCentral()
        jcenter()
    }
}
4
  • /usr/local/DexGuard6.1.19/lib exists? Can you remove that section and try again? Commented Dec 4, 2015 at 7:37
  • Yes, the directory exists. I use the same code with 1.2.3 and it works but when I change build tools version to 1.3.1 there is this error. Commented Dec 4, 2015 at 7:39
  • Could you try: 1. Use com.android.tools.build:gradle:1.5.0 (perhaps you need to update your SDK first. 2. Ensure to use the latest gradle version (2.9). Commented Dec 4, 2015 at 7:40
  • I am using latest gradle version 2.9. I tried changing to 1.5.0 but still the same error. Commented Dec 4, 2015 at 8:01

1 Answer 1

1

The Android Gradle plugin is still evolving, with changing tasks and internals. You have to make sure you update the DexGuard Gradle plugin accordingly.

  • For Android plugin 1.3.1, you'll need DexGuard 7.0.01 or higher.
  • For Android plugin 1.5.0, you'll need DexGuard 7.0.31 or higher
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.