Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build script error, unsupported Gradle DSL method found: 'release()'!

I am using Android studio 0.50 release and gradle 1.11-all in my gradle wrapper. I have 3 modules and following are the build.gradle files.

Module 1

apply plugin: 'android'
apply plugin: 'android-test'

android {
compileSdkVersion 19
buildToolsVersion '19.0.1'

packagingOptions {
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
}

defaultConfig {
    minSdkVersion 10
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

sourceSets {
    androidTest.setRoot('src/test')

}
}

Module 2

apply plugin: 'android-library'
apply plugin: 'android-test'

android {
compileSdkVersion 19
buildToolsVersion "19.0.1"

defaultConfig {
    minSdkVersion 10
    targetSdkVersion 16
    versionCode 1
    versionName "1.0"
}
release {
    runProguard false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
sourceSets {
    instrumentTest.setRoot('src/test')
}
}

project root build.gralde

buildscript {
repositories {
    mavenCentral()
    mavenLocal()
    maven {
        url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:0.9.+'
    classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT'
    classpath 'com.nineoldandroids:library:2.4.0'
}
}

allprojects {
repositories {
    mavenCentral()
    mavenLocal()
    maven {
        url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
}
}

Sorry for the long question, I tried removing the packaging options and mentioned in this thread, but no luck. Am I missing anything?

like image 758
sanath01 Avatar asked Mar 07 '14 17:03

sanath01


2 Answers

Per the Migrating to Gradle 0.9 guide (as Gradle 0.9 is required for Android Studio 0.5.0):

The DSL for the library projects is now the same as for the application projects. This means you can create more build types, and create flavors.

Therefore

android {
    debug {
    }
    release {
    }
    debugSigningConfig {
    }
}

becomes

android {
    buildTypes {
        debug {
        }
        release {
        }
    }
    signingConfigs {
        debug {
        }
    }
}
like image 141
ianhanniballake Avatar answered Oct 14 '22 13:10

ianhanniballake


As described here:

http://tools.android.com/tech-docs/new-build-system/migrating_to_09

The DSL for the library projects is now the same as for the application projects

In particolar you have to put the release block inside the buildTypes.

android {
    buildTypes {
        debug {
        }
        release {
        }
    }
like image 38
Gabriele Mariotti Avatar answered Oct 14 '22 13:10

Gabriele Mariotti