没有找到gradle dsl ndkBuild()

时间:2015-12-28 20:35:01

标签: android android-ndk dsl ndk-build

Error:(8, 0) Gradle DSL method not found: 'ndkBuild()'
Possible causes:<ul><li>The project 'OCR4' may be using a version of Gradle that does not contain the method.
<a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>

我的代码中有上述错误,尽管我已经包含了所有依赖项。还指定了ndk-build的路径

task ndkBuild(type: Exec) {
        workingDir = file("${android.sdkDirectory}/ndk-bundle")
        if (Os.isFamily(Os.FAMILY_WINDOWS)) {
            commandLine 'C:\\Users\\yogita\\Download\\android-ndk-r10e\\ndk-build.cmd', '-C', file('.').absolutePath,
                    '-j', Runtime.runtime.availableProcessors()
        } else {
            commandLine './ndk-build', '-C', file('.').absolutePath,
                    '-j', Runtime.runtime.availableProcessors()
        }
    }

    tasks.withType(JavaCompile) {
        compileTask -> compileTask.dependsOn ndkBuild
    }

    // cleanup task
    task ndkClean(type: Exec) {
        workingDir = file("${android.sdkDirectory}/ndk-bundle")
        if (Os.isFamily(Os.FAMILY_WINDOWS)) {
            commandLine 'C:\\Users\\yogita\\Download\\android-ndk-r10e\\ndk-build.cmd', '-C', file('.').absolutePath, 'clean'
        } else {
            commandLine './ndk-build', '-C', file('.').absolutePath, 'clean'
        }
    }

    tasks.withType(Delete) {
        cleanTask -> cleanTask.dependsOn ndkClean
    }

0 个答案:

没有答案