我知道有很多类似的主题,但没有一个帮助和相信我试图运行这个超过2天。 我想运行面部检测样本,而且我坚持使用ndk build
Application.mk
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-23
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=SHARED
include C:/Users/dpach/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
LOCAL_SRC_FILES := DetectionBasedTracker_jni.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS += -llog -ldl
LOCAL_MODULE := detection_based_tracker
include $(BUILD_SHARED_LIBRARY)
app.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "threewe.testopencv"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
task ndkBuild(type: Exec) {
commandLine 'C:\\Users\\dpach\\android-ndk-r12\\ndk-build.cmd', '-C', file('jni').absolutePath
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha2'
compile project(':libraries:opencv')
}
错误
System nie moľe odnale«† okre?lonej ?cieľki.
make: *** [C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/obj/local/armeabi-v7a/objs/detection_based_tracker/DetectionBasedTracker_jni.o] Error 1
make: Leaving directory `C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/jni'
:app:ndkBuild FAILED
Error:Execution failed for task ':app:ndkBuild'.
> Process 'command 'C:\Users\dpach\android-ndk-r12\ndk-build.cmd'' finished with non-zero exit value 2
错误的翻译:'系统无法找到指定的路径'
我检查了路径并且它存在我甚至把文件放在另一个项目中,但结果是一样的。我也试过从控制台手动运行ndk-build.cmd,但结果是一样的,所以这不是Android Studio的问题。我不知道我还能做些什么:(
//编辑
添加了V=1
参数
make: Entering directory `C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/jni'
[armeabi-v7a] "Compile++ thumb": "detection_based_tracker <= DetectionBasedTracker_jni.cpp"
C:/Users/dpach/android-ndk-r12/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/obj/local/armeabi-v7a/objs/detection_based_tracker/DetectionBasedTracker_jni.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -g -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fno-exceptions -fno-rtti -mthumb -Os -DNDEBUG -I"C:/Users/dpach/OpenCV-android-sdk/sdk/native/jni/include/opencv" -I"C:/Users/dpach/OpenCV-android-sdk/sdk/native/jni/include" -IC:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/jni -IC:/Users/dpach/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/include -IC:/Users/dpach/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -IC:/Users/dpach/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/backward -IC:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/jni -DANDROID -fPIC -DANDROID -fsigned-char -Wa,--noexecstack -Wformat -Werror=format-security -frtti -fexceptions -isystem C:/Users/dpach/android-ndk-r12/build//../platforms/android-23/arch-arm/usr/include -c C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/jni/DetectionBasedTracker_jni.cpp -o C:/Users/dpach/AndroidStudioProjects/TestOpenCv/app/obj/local/armeabi-v7a/objs/detection_based_tracker/DetectionBasedTracker_jni.o