NDK没有这样的目录或文件错误

时间:2016-04-21 18:20:13

标签: java android c++ opencv android-ndk

我正在尝试在Android中编译.so个文件,第一个问题是当我直接使用gradle它运行完美但没有生成.so文件时,所以我求助于调用{{ 1}}我自己,我对我的ndk文件进行了一些更改,现在它看起来像我的`:

gradle.build

}

当我编译我的代码时,它只是给我一个错误,说apply plugin: 'com.android.application' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 23 buildToolsVersion '23.0.3' defaultConfig { applicationId "nemo.lungu.receiptor" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" multiDexEnabled false ndk { moduleName "Scanner" stl "stlport_shared" } } sourceSets.main { jniLibs.srcDir 'src/main/libs' //set .so files location to libs jni.srcDirs = [] //disable automatic ndk-build call } // call regular ndk-build(.cmd) script from app directory task ndkBuild(type: Exec) { if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath } else { commandLine 'ndk-build', '-C', file('src/main').absolutePath } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors { } 遇到错误所以我采用方法3;手动编译ndk文件,我的.so文件如下所示:

Android.mk

LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) OPENCV_INSTALL_MODULES:=on include .../sdk/native/jni/OpenCV.mk LOCAL_MODULE := Scanner LOCAL_SRC_FILES := scan.cpp LOCAL_LDLIBS += -lm -llog -landroid LOCAL_LDFLAGS += -ljnigraphics include $(BUILD_SHARED_LIBRARY) 看起来像:

Application.mk

我的新错误现在无法找到APP_STL := stlport_static APP_CPPFLAGS := -frtti -fexceptions APP_ABI := armeabi-v7a APP_PLATFORM := android-15 ,我正在从cmd运行ndk,如下所示

  1. 打开cmd并导航到ndk目录
  2. 运行sdk/native/jni/OpenCV.mk,如果我的项目在我的C目录的根目录中为ndk-build NDK_PROJECT_PATH=full/path/to/project APP_BUILD_SCRIPT=full/path/to/project/Android.mk,则为Mario
  3. 任何人都知道如何通过此错误?

0 个答案:

没有答案