使用实验性 gradle 0.6.0 时的"Error:Cause: org.gradle.model.internal.report.unbound.UnboundRule"



本文 http://tools.android.com/tech-docs/new-build-system/gradle-experimental 使我的项目使用AndroidStudio进行调试

使用以下 gradle 配置,列出了错误"错误:原因:org.gradle.model.internal.report.unbound.UnboundRule"

build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle-experimental:0.6.0-beta5'
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
gradle/wrapper

/gradle-wrapper.properties

#Wed Oct 21 11:34:03 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip

app/build.gradle:

apply plugin: 'com.android.model.application'
model {
    android {
        compileSdkVersion = 23
        buildToolsVersion = "23.0.2"
        useLibrary 'org.apache.http.legacy'
        ndk {
            moduleName = "nativemodule"
        }
        defaultConfig.with {
            applicationId = "package.name"
            minSdkVersion.apiLevel = 10
            targetSdkVersion.apiLevel = 23
            multiDexEnabled = true
        }
        lintOptions {
            checkReleaseBuilds = false
            abortOnError = false
        }
        dexOptions {
            incremental = false
            javaMaxHeapSize = "2048M"
        }
        signingConfigs {
            create("debug") {
                storeFile 'myapp.keystore'
                storePassword "xxx"
                keyAlias "xxx"
                keyPassword "xxx"
                storeType "jks"
            }
            create("release") {
                storeFile 'myapp.keystore'
                storePassword "xxx"
                keyAlias "xxx"
                keyPassword "xxx"
                storeType "jks"
            }
        }
        buildTypes {
            debug {
                minifyEnabled = false
                zipAlignEnabled = false
                shrinkResources = false
                signingConfig = $("android.signingConfigs.debug")
                ndk {
                    debuggable = true
                }
            }
            release {
                minifyEnabled = true
                zipAlignEnabled = true
                shrinkResources = true
                signingConfig = $("android.signingConfigs.release")
                ndk {
                    debuggable = false
                }
                proguardFiles.add(file('proguard.cfg'))
            }
        }
    }
}
dependencies {
    compile 'com.android.support:multidex:1.0.0'
}

"注意:android.signingConfigs 当前必须在 android {} 块之外。

移动签名配置{}块出安卓{}块,错误已修复

最新更新