0

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

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

构建.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

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

1 回答 1

2

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

将 signingConfigs {} 块移出 android {} 块,已修复错误

于 2016-03-03T06:08:52.550 回答