简体   繁体   English

错误:无此类属性:android类:com.android.build.gradle.managed.AndroidConfig

[英]Error:No such property: android for class: com.android.build.gradle.managed.AndroidConfig

I'm trying to build my android project using NDK but when I change build.gradle file, android studio show me error and I can't sync gradle. 我正在尝试使用NDK构建我的android项目,但是当我更改build.gradle文件时,android studio显示错误并且无法同步gradle。 Can you help me to fix this? 你能帮我解决这个问题吗? My dependencies 我的依赖

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}

and my build.gradle 和我的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"
    }
}

Thanks for help! 感谢帮助!

Have a look at this answer https://stackoverflow.com/a/32312074/593978 看看这个答案https://stackoverflow.com/a/32312074/593978

You have everything inside android{} block, whereas most of your entries should be outside of it. 您将所有内容都放在了android {}块中,而您的大多数条目都应该在它之外。 This might be causing your exception. 这可能导致您的异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM