使用实验gradle 0.6.0时出现“错误:原因:org.gradle.model.internal.report.unbound.UnboundRule”

时间:2016-03-03 05:51:55

标签: android-studio gradle-experimental

按照本文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 /包装/ 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

应用程序/的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'
}

1 个答案:

答案 0 :(得分:2)

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

移动了signedConfigs {}阻止了android {}阻止,修复了错误