Android Studio 1.4.1错误:(15,0)未找到Gradle DSL方法:"ndk()" [英] android studio 1.4.1 Error:(15, 0) Gradle DSL method not found: 'ndk()'

查看:103
本文介绍了Android Studio 1.4.1错误:(15,0)未找到Gradle DSL方法:"ndk()"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在在线关注本教程

https://youtu.be/kFtxo7rr2HQ

当我尝试建造时,我不断得到他的帮助:

and when I tried to build I keep gettingt his:

错误:(15,0)未找到Gradle DSL方法:"ndk()" 可能的原因:

  • 项目"NDKTest"可能正在使用不包含该方法的Gradle版本. Gradle设置
  • 构建文件可能缺少Gradle插件. 应用Gradle插件
  • Error:(15, 0) Gradle DSL method not found: 'ndk()' Possible causes:

  • The project 'NDKTest' may be using a version of Gradle that does not contain the method. Gradle settings
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • 我已经尝试过该线程:

    找不到Android Studio Gradle DSL方法:"android()'-错误(17,0)

    但是现在已经很老了.

    这是我的build.gradle文件

    here's my build.gradle file

    apply plugin: 'com.android.application'
    android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    
    defaultConfig {
        applicationId "com.guitarv.www.ndktest"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    
    ndk {
    
                moduleName = "HelloJNI"
        }
    
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    }
    

    Android Studio 1.4.1 android-ndk-r10e

    Android Studio 1.4.1 android-ndk-r10e

    任何人都知道发生了什么事吗?

    Anyone knows what is going on?

    thx!

    推荐答案

    将ndk移至defaultConfig范围.也许,您也想添加sourceSets.main范围

    Move the ndk to the defaultConfig scope. Maybe, you'll want to add the sourceSets.main scope too

    apply plugin: 'com.android.application'
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"
    
        defaultConfig {
            applicationId "com.guitarv.www.ndktest"
            minSdkVersion 17
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            ndk {
                moduleName = "HelloJNI"
            }
            sourceSets.main {
                jni.srcDirs = []
                jniLibs.srcDir "src/main/libs"
            }
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    

    这篇关于Android Studio 1.4.1错误:(15,0)未找到Gradle DSL方法:"ndk()"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆