适用于Android Studio 1.3中的实验性Gradle构建工具的lintOptions

时间:2015-08-30 09:38:25

标签: android android-studio android-gradle build.gradle gradle-experimental

由于Android Studio 1.3支持NDK,我尝试在此链接http://tools.android.com/tech-docs/new-build-system/gradle-experimental之后转换我的Gradle脚本(build.gradle app / build.gradle和gradle-wrapper.properties)。

但是,我无法从教程和ndk示例存储库https://github.com/googlesamples/android-ndk

中找到有关 lintOptions 的任何指导

我的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
        }
    }
}

同步失败并显示日志:错误:原因:com.android.build.gradle.managed.AndroidConfig_Impl

如果我删除 lintOptions 块,它似乎同步OK但稍后构建失败。

2 个答案:

答案 0 :(得分:6)

它应该以&#34; android为前缀。&#34;在模型{}

model{

  android.lintOptions {
       checkReleaseBuilds = false
  }
}

答案 1 :(得分:1)

也许我说的很明显,但你的代码似乎有一个迷路}

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

    android.buildTypes {
    release {
        minifyEnabled = true
    }
}