Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lintOptions for experimental Gradle build tool in Android Studio 1.3

As Android Studio 1.3 coming with NDK support, I tried to convert my Gradle scripts (build.gradle app/build.gradle and gradle-wrapper.properties) following this link http://tools.android.com/tech-docs/new-build-system/gradle-experimental.

However, I cannot find any guidance about lintOptions from both the tutorial as well as ndk example repository https://github.com/googlesamples/android-ndk

My app/build.gradle

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

model {
    android {
        compileSdkVersion = 21
        buildToolsVersion = "21.1.2"

        defaultConfig.with {
            applicationId = "com.abc.xyz"
            minSdkVersion.apiLevel = 9
            targetSdkVersion.apiLevel = 21
        }

        compileOptions.with {
            sourceCompatibility=JavaVersion.VERSION_1_7
            targetCompatibility=JavaVersion.VERSION_1_7
        }

        lintOptions {       // <-- this block
            checkReleaseBuilds false
        }
    }

        android.buildTypes {
        release {
            minifyEnabled = true
        }
    }
}

The sync failed with log: Error:Cause: com.android.build.gradle.managed.AndroidConfig_Impl

If I remove the lintOptions block, it seems to sync OK but build fails later.

like image 422
Long_GM Avatar asked Mar 14 '23 22:03

Long_GM


2 Answers

It should be prefixed with "android." inside the model{ }

model{

  android.lintOptions {
       checkReleaseBuilds = false
  }
}
like image 148
Gabriele Mariotti Avatar answered Apr 07 '23 07:04

Gabriele Mariotti


Perhaps I'm stating the obvious, but your code appears to have a stray }

    lintOptions {       // <-- this block
        checkReleaseBuilds false
    }
} // <-- Stray closes off the buildTypes info

    android.buildTypes {
    release {
        minifyEnabled = true
    }
}
like image 33
Donny Ogden Avatar answered Apr 07 '23 06:04

Donny Ogden