【问题标题】:Error:No such property: android for class: com.android.build.gradle.managed.AndroidConfig错误:没有这样的属性:类的android:com.android.build.gradle.managed.AndroidConfig
【发布时间】:2017-04-01 03:34:06
【问题描述】:

我正在尝试使用 NDK 构建我的 android 项目,但是当我更改 build.gradle 文件时,android studio 显示错误并且我无法同步 gradle。你能帮我解决这个问题吗? 我的依赖

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle-experimental:0.9.0'
    classpath 'com.google.gms:google-services:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
allprojects {
repositories {
    jcenter()
}
task clean(type: Delete) {
delete rootProject.buildDir}

还有我的 build.gradle

apply plugin: 'com.android.model.application'
model {
android {
    compileSdkVersion 24
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.mycompany.myproject"
        minSdkVersion.apiLevel 15
        targetSdkVersion.apiLevel 24
        versionCode 11
        versionName "3.1"
        multiDexEnabled true
    }
    buildTypes {
        release {
            debuggable true
            minifyEnabled true
            proguardFiles.add(file("proguard-rules.pro"))
            signingConfig = $("android.signingConfigs.myConfig")
        }
        debug {
            debuggable true
        }
    }
    ndk {
        moduleName = "name"
    }
    android.lintOptions {
        disable 'MissingTranslation'
    }
    android.dexOptions {
        javaMaxHeapSize "4g"
    }
    android.productFlavors {
        manifestPlaceholders = [onesignal_app_id: "onesignalId",
                                local value is ignored.
                                onesignal_google_project_number: "projectnumber"]
    }
}
android.signingConfigs {
    create("myConfig") {
        keyAlias 'alias'
        keyPassword 'mypassword'
        storeFile file('mypath')
        storePassword 'mypassword'
        storeType "jks"
    }
}

感谢您的帮助!

【问题讨论】:

    标签: java android android-studio android-ndk


    【解决方案1】:

    看看这个答案https://stackoverflow.com/a/32312074/593978

    您在 android{} 块中拥有所有内容,而您的大部分条目应该在它之外。这可能会导致您的异常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-04-11
      • 2011-04-15
      • 1970-01-01
      • 2016-08-28
      • 1970-01-01
      • 1970-01-01
      • 2014-07-14
      相关资源
      最近更新 更多