NDK-从NDK中删除GNUSTL之后的问题(修订版r18) [英] NDK - problems after GNUSTL has been removed from the NDK (revision r18)
问题描述
今天,我将Android Studio NDK更新为最新版本18.0.5002713
.在成功完成安装过程之后,我尝试重新运行我的应用程序,但无法执行此操作.不断出现的错误如下:org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
Today I updated my Android Studio NDK to the most recent release 18.0.5002713
. After the successful installation process I tried to rerun my app but was not able to do so. The error that keeps appearing is the following: org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
过去,NDK更新后我在运行应用程序时遇到了问题,但是能够通过在app.gradle文件中的externalNativeBuild
配置中添加arguments '-DANDROID_STL=gnustl_static'
来解决这些问题.
In the past I've already had problems running my app after NDK updates but was able to resolve them by adding arguments '-DANDROID_STL=gnustl_static'
to the externalNativeBuild
configuration in the app.gradle file.
原始问题:( OpenCV-未定义对'cv :: CascadeClassifier :: detectMultiScale的引用()在NDK更新之后)
通过添加这一行代码,我设法在所有NDK r17c其余版本中避免了NDK的任何问题.
By adding this line of code I managed to avoid any sort of problem with the NDK throughout the rest of all NDK r17c releases.
不幸的是,在r18修订版中,与gabi ++和stlport一起删除了对GNUSTL的支持.
Unfortunately with revision r18 the support for GNUSTL has been removed alongside gabi++ and stlport.
请参阅NDK修订历史记录: https://developer.android.com/ndk/downloads/version_history
See NDK revision history: https://developer.android.com/ndk/downloads/revision_history
删除现在不建议使用的代码行会产生错误,该错误最初是上述问题的原因.现在的问题是arguments '-DANDROID_STL=gnustl_static'
的最新等效内容是什么?
Removing the now deprecated line of code produces the error that originally was the reason for the aforementioned question. The question now is what is the up-to-date equivalent of arguments '-DANDROID_STL=gnustl_static'
?
使用'-DANDROID_STL=c++_static'
会导致旧错误
谢谢.
推荐答案
正如@Michael所建议的那样,您可以使用libc ++重建OpenCV.
As @Michael already suggested you can rebuild the OpenCV with libc++.
要这样做:
cd $OPENCV_SRC
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_DIR/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_STL=c++_static -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-24 ..
make install
cd install #the sdk will be here...
注意: 使用"opencv-3.4.1" + ndk18进行了测试
NOTE: tested with "opencv-3.4.1" + ndk18
由@shizhen编辑
在macOS上进行了验证,应在cmake
命令后添加..
以使以下错误消失.
Verified on macOS, should add ..
after cmake
command to make below error disappear.
CMake错误:源目录"/opencv-3.4.1/build"似乎不包含
CMakeLists.txt
.
更新如下:
cd $OPENCV_SRC
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$ANDROID_DIR/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_STL=c++_static -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-24
make install
cd install #the sdk will be here...
这篇关于NDK-从NDK中删除GNUSTL之后的问题(修订版r18)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!