Android NDK:您确定NDK_MODULE_PATH变量是否已正确定义?错误

时间:2016-01-04 21:35:26

标签: android eclipse android-ndk cocos2d-x

我将项目作为Eclipse项目,我将其移至Android studio

构建现在运行良好,但是当我尝试运行应用程序时,我收到错误消息

这是我的项目结构:

Proj

这是我的gradle文件:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.testProj.test1"
        minSdkVersion 10
        targetSdkVersion 23

        ndk {
            moduleName "player_shared"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    sourceSets {
//        jni.srcDirs = [] // This prevents the auto generation of Android.mk
        main.jniLibs.srcDirs = ['libs']
        test.jniLibs.srcDirs = ['libs']
    }
//    sourceSets.main {
//        jni.srcDirs = [] // This prevents the auto generation of Android.mk
//        jniLibs.srcDir 'src/main/libs' // This is not necessary unless you have precompiled libraries in your project.
//    }
    task buildNative(type: Exec, description: 'Compile JNI source via NDK') {
        def ndkDir = android.ndkDirectory
        commandLine "$ndkDir/ndk-build",
                '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source
                '-j', Runtime.runtime.availableProcessors(),
                'all',
                'NDK_DEBUG=1'
    }

    task cleanNative(type: Exec, description: 'Clean JNI object files') {
        def ndkDir = android.ndkDirectory
        commandLine "$ndkDir/ndk-build",
                '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source
                'clean'
    }

    clean.dependsOn 'cleanNative'

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

dependencies {
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/PTAdChartboost.jar')
    compile files('libs/dagger-1.2.2.jar')
    compile files('libs/javax.inject-1.jar')
    compile files('libs/nineoldandroids-2.4.0.jar')
    compile files('libs/support-v4-19.0.1.jar')
}

这是Android.mk文件:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := player_shared

LOCAL_MODULE_FILENAME := libplayer

LOCAL_SRC_FILES := main.cpp 

LOCAL_WHOLE_STATIC_LIBRARIES :=  core_static cocos2dx_static box2d_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module, core)
$(call import-module, cocos2dx)
$(call import-module, box2D)

错误消息:

Error:(15) *** Android NDK: Aborting.    .  Stop.
Android NDK: /Users/mylaptop/Documents/Lines/app/src/main/jni/Android.mk: Cannot find module with tag 'core' in import path    
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?    
Android NDK: The following directories were searched:    
Android NDK:         
make: Entering directory `/Users/mylaptop/Documents/Lines/app/src/main/jni'
make: Leaving directory `/Users/mylaptop/Documents/Lines/app/src/main/jni'
:app:buildNative FAILED
Error:Execution failed for task ':app:buildNative'.
> Process 'command '/Users/mylaptop/Documents/android-ndk-r10e/ndk-build'' finished with non-zero exit value 2

0 个答案:

没有答案