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:配置项目':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 更新后运行我的应用程序时遇到了问题,但能够通过将 arguments '-DANDROID_STL=gnustl_static'
添加到 externalNativeBuild
来解决这些问题app.gradle 文件中的配置.
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 版本中,对 GNUSTL 的支持与 gabi++ 和 stlport 一起被删除了.
Unfortunately with revision r18 the support for GNUSTL has been removed alongside gabi++ and stlport.
查看 NDK 修订历史:https://developer.android.com/ndk/downloads/修订历史
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
.
CMake Error: The source directory "/opencv-3.4.1/build"does not appear to contain
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屋!