如何在Android Studio中构建OpenCV示例

时间:2018-12-22 19:47:20

标签: java c++ android-studio opencv

  1. 创建了一个空的Android Studio项目没有c ++支持
  2. 导入了一个新模块(OpenCV文件夹sdk / java)
  3. 在项目结构->模块应用依赖项->添加的库模块中
  4. 使用OpenCV文件夹sdk / native / jni
  5. 中的文件对myproject / app / src / main / jniLibs 文件夹进行了重新设置
  6. 导入了一个新模块(OpenCV文件夹样本/面部检测)
  7. 将build.gradle(openCV,openCVsample)的compileSdkVersion和targetSdkVersion从build.gradle(app)更改为版本(28)
  8. 我收到了错误消息:
  

错误:您的项目包含一个本机生成系统。考虑使用   CMake或ndk-build集成。有关更多信息,请访问:   https://d.android.com/r/studio-ui/add-native-code.html或者,   您可以使用实验性插件:   https://developer.android.com/r/tools/experimental-pl ..

  1. 使用Gradle (openCVsample)
  2. 单击了Link c ++项目
  3. 我在构建系统中选择了 ndk-build ,并将路径设置为myproject / openCVSamplefacedetection / build / intermediates / ndk / debug / Android.mk
  4. 我收到了错误消息:
  

构建命令失败。执行过程时出错   D:\ Android \ ndk-bundle \ ndk-build.cmd带参数   {NDK_PROJECT_PATH =空   APP_BUILD_SCRIPT = D:\ myproject \ openCVSamplefacedetection \ build \ intermediates \ ndk \ debug \ Android.mk   APP_ABI = arm64-v8a NDK_ALL_ABIS = arm64-v8a NDK_DEBUG = 1   APP_PLATFORM = android-21   NDK_OUT = D:/ myproject / openCVSamplefacedetection / build / intermediates / ndkBuild / debug / obj   NDK_LIBS_OUT = D:\ myproject \ openCVSamplefacedetection \ build \ intermediates \ ndkBuild \ debug \ lib   D:/myproject/openCVSamplefacedetection/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/libdetection_based_tracker.so}   Android NDK:警告:中的不支持的源文件扩展名   D:\ myproject \ openCVSamplefacedetection \ build \ intermediates \ ndk \ debug \ Android.mk   对于模块detection_based_tracker Android NDK:   D:\ myproject \ openCVSamplefacedetection \ src \ main \ jni \ Android.mk   D:\ myproject \ openCVSamplefacedetection \ src \ main \ jni \ Application.mk   [arm64-v8a]编译++:detection_based_tracker <=   DetectionBasedTracker_jni.cpp   D:\ myproject \ openCVSamplefacedetection \ src \ main \ jni \ DetectionBasedTracker_jni.cpp:2:10:   致命错误:找不到“ opencv2 / core.hpp”文件   包括^ ~~~~~~~~~~~~~~~~~产生1个错误。使:   [D:/ myproject / openCVSamplefacedetection / build / intermediates / ndkBuild / debug / obj / local / arm64-v8a / objs-debug / detection_based_tracker / D__back \ ProDVR \ openCVSamplefacedetection \ src \ main \ jni \ DetectBasedTracker_jni.o]   错误1

我该如何解决?

0 个答案:

没有答案