1

I'm trying to add a module dependency in Android Studio 1.0, and when the projects sync I'm running into this Gradle error. I get the "Gradle project sync failed" message with the following error: Error: Gradle DSL method not found: 'isReleaseBuild()'.

Below is my build.gradle file. I tried a fix that said to remove the line apply from: './maven_push.gradle', but after that it would repeatedly say that I have to download an SDK update.

apply plugin: 'android-library'

android {
    compileSdkVersion 20
    buildToolsVersion "20"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 20
        versionCode 2
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
}

// This is the actual solution, as in http://stackoverflow.com/a/19037807/1002054
task clearJar(type: Delete) {
    delete 'build/libs/myCompiledLibrary.jar'
}

task makeJar(type: Copy) {
    from('build/intermediates/bundles/release/')
    into('build/libs/')
    include('classes.jar')
    rename ('classes.jar', 'myCompiledLibrary.jar')
}

makeJar.dependsOn(clearJar, build)

apply from: './maven_push.gradle'
terpak
  • 1,131
  • 3
  • 17
  • 35

1 Answers1

0

You must add isReleaseBuild code into root build.gradle

def isReleaseBuild() {
    return version.contains("SNAPSHOT") == false}
}
Akexorcist
  • 2,287
  • 1
  • 16
  • 19