在机器人工作室ndk.dir错误机器人、错误、工作室、ndk

2023-09-04 03:04:09 作者:俄為自己帶盐

我试图用OpenCV库,所以我进口它在Android的Studio项目之一,当我试图运行它,我得到这个错误:

I was trying to use opencv library, so I imported one of its projects in Android Studio and when I tried to run it I got this error:

错误:未能执行任务:openCVSamplefacedetection:compileDebugNdk。   NDK没有配置。   从 http://developer.android.com/tool​​s/sdk/ndk/下载NDK 。然后添加ndk.dir =路径/到/ NDK的local.properties。   (在Windows中,一定要逃离反斜杠,例如C:\ NDK,而不是C:\ NDK)

Error:Execution failed for task ':openCVSamplefacedetection:compileDebugNdk'. NDK not configured. Download the NDK from http://developer.android.com/tools/sdk/ndk/.Then add ndk.dir=path/to/ndk in local.properties. (On Windows, make sure you escape backslashes, e.g. C:\ndk rather than C:\ndk)

于是我下载了NDK,我就将此此行到它成为了local.properties文件:

So I downloaded the ndk and I addes this line to the local.properties file where it became:

sdk.dir=C\:\\Users\\skoon\\AppData\\Local\\Android\\sdk
ndk.dir=C\:\\Users\\skoon\\AppData\\Roaming\\IDM\\android-ndk-r10d

但我仍然得到这个错误,我不明白:

but I still got this error which I didn't understand:

错误:未能执行任务:openCVSamplefacedetection:compileDebugNdk。   com.android.ide.common.internal.LoggedErrorException:无法运行命令:       C:\ Users \用户skoon \应用程序数据\漫游\ IDM \的Andr​​oid NDK,r10d \ NDK,build.cmd NDK_PROJECT_PATH = NULL APP_BUILD_SCRIPT=C:\Users\skoon\Downloads\Com$p$pssed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\Android.mk APP_PLATFORM =机器人-14 NDK_OUT=C:\Users\skoon\Downloads\Com$p$pssed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\obj NDK_LIBS_OUT=C:\Users\skoon\Downloads\Com$p$pssed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\lib APP_ABI =所有   错误code:       2   输出:       make.exe:***没有规则,使目标'C:\Users\skoon\Downloads\Com$p$pssed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/detection_based_tracker/C_\Users\skoon\Downloads\Com$p$pssed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\src\main\jni',需要`C:\Users\skoon\Downloads\Com$p$pssed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/detection_based_tracker/C_\Users\skoon\Downloads\Com$p$pssed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\src\main\jni\DetectionBasedTracker_jni.o'.停止。

Error:Execution failed for task ':openCVSamplefacedetection:compileDebugNdk'. com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Users\skoon\AppData\Roaming\IDM\android-ndk-r10d\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\Android.mk APP_PLATFORM=android-14 NDK_OUT=C:\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\obj NDK_LIBS_OUT=C:\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\lib APP_ABI=all Error Code: 2 Output: make.exe: *** No rule to make target 'C:\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/detection_based_tracker/C_\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\src\main\jni', needed by `C:\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/detection_based_tracker/C_\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\src\main\jni\DetectionBasedTracker_jni.o'. Stop.

我并没有改变,在code什么,所以我应该怎么办?我需要改变或变量点添加到NDK?

I didn't change anything in the code, so what should I do? do I need to change or add any variables to point to the ndk?

P.S。这是我第一次尝试构建Android应用程序,所以我没有任何经验。

P.S. This is my first time trying to build Android application so I don't have any experience.

感谢你在前进。

更新:

要导入我只是用导入的项目从文件的项目,那我的同步gardle,并运行该项目。 我来自OpenCV的下载软件包是Android的一个,我试图用脸检测样本。 当我运行它,我得到了上面的错误。

To import the project I just used import project from file, then I synced the gardle, and run the project. the package that I downloaded from opencv was the Android one, and I tried to use the face detection sample. when I run it I got the error above.

推荐答案

您需要安装OpenCV的librairies为您的项目。你可以在这里按照说明。

You need to setup OpenCV librairies for your project. You can follow the instruction here.

 
精彩推荐