在Android Studio中找不到OpenCV

时间:2015-08-03 09:54:16

标签: android c++ opencv

所以我试过这个link在android studio中设置openCV和NDK。但是,当我尝试调试应用程序时,出现错误

Note: C:\Users\Jeems\Documents\pulse-android1\pulseandroid\src\main\java\org\opencv\android\MyJavaCameraView.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:pulseandroid:compileDebugNdk
In file included from C:\Users\Jeems\Documents\pulse-android1\pulseandroid\src\main\jni\EvmGdownIIR.cpp:1:0:
C:\Users\Jeems\Documents\pulse-android1\pulseandroid\src\main\jni\EvmGdownIIR.hpp:4:33: fatal error: opencv2/core/core.hpp: No such file or directory
 #include <opencv2/core/core.hpp>
                                 ^
compilation terminated.
make.exe: *** [C:\Users\Jeems\Documents\pulse-android1\pulseandroid\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/pulse/C_\Users\Jeems\Documents\pulse-android1\pulseandroid\src\main\jni\EvmGdownIIR.o] Error 1
Error:Execution failed for task ':pulseandroid:compileDebugNdk'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Jeems\Documents\android-ndk-r10e\ndk-build.cmd'' finished with non-zero exit value 2

我不能在我的项目中包含opencv2。

enter image description here

那我错过了什么步骤?

所以,我一直在做这个项目,直到出现这个新的错误。

:pulseandroid:ndkBuild
SharedLibrary  : libpulse.so
C:/Users/Jeems/Documents/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: build/intermediates/ndk/obj/local/armeabi/objs/pulse/pt_fraunhofer_pulse_Pulse_Face.o: in function i::Java_pt_fraunhofer_pulse_Pulse_00024Face(double):src/main/jni/pt_fraunhofer_pulse_Pulse_Face.cpp:24: error: undefined reference to '__android_log_print'
C:/Users/Jeems/Documents/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: build/intermediates/ndk/obj/local/armeabi/objs/pulse/pt_fraunhofer_pulse_Pulse_Face.o: in function i::Java_pt_fraunhofer_pulse_Pulse_00024Face(double):src/main/jni/pt_fraunhofer_pulse_Pulse_Face.cpp:42: error: undefined reference to '__android_log_print'
C:/Users/Jeems/Documents/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: build/intermediates/ndk/obj/local/armeabi/objs/pulse/pt_fraunhofer_pulse_Pulse_Face.o: in function Java_pt_fraunhofer_pulse_Pulse_00024Face__1box:src/main/jni/pt_fraunhofer_pulse_Pulse_Face.cpp:54: error: undefined reference to '__android_log_print'
C:/Users/Jeems/Documents/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: build/intermediates/ndk/obj/local/armeabi/objs/pulse/pt_fraunhofer_pulse_Pulse_Face.o: in function Java_pt_fraunhofer_pulse_Pulse_00024Face__1box:src/main/jni/pt_fraunhofer_pulse_Pulse_Face.cpp:74: error: undefined reference to '__android_log_print'
collect2: ld returned 1 exit status
make: *** [build/intermediates/ndk/obj/local/armeabi/libpulse.so] Error 1
:pulseandroid:ndkBuild FAILED
Error:Execution failed for task ':pulseandroid:ndkBuild'.
> Process 'command 'C:\Users\Jeems\Documents\android-ndk-r8d\ndk-build.cmd'' finished with non-zero exit value 2

1 个答案:

答案 0 :(得分:0)

检查openCV环境变量的包含路径,如果不添加,请将其添加到系统路径。