Java 不再支持 Android NDK APP_STL gnustl_shared
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52475177/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android NDK APP_STL gnustl_shared is no longer supported
提问by Ha Noi Chieu Mua
I am buiding an android NDK project with Android Studio 3.3 Canady 11, when build project, I got this error:
我正在使用 Android Studio 3.3 Canady 11 构建一个 android NDK 项目,在构建项目时,出现此错误:
Build command failed. Error while executing process /home/ndqa/opt/Android-SDK/ndk-bundle/ndk-build with argument {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/Android.mk NDK_APPLICATION_MK=/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-23 NDK_OUT=/home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib APP_PLATFORM=android-21 -j10 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
/home/ndqa/opt/Android-SDK/ndk-bundle/build/core/add-application.mk:178: *** Android NDK: APP_STL gnustl_shared is no longer supported. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.htmlfor more information. . Stop.
构建命令失败。使用参数 {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp 执行进程 /home/ndqa/opt/Android-SDK/ndk-bundle/ndk-build 时出错/Android.mk NDK_APPLICATION_MK=/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-23 NDK /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib APP_PLATFORM=android-21 -j10 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
/home/ndqa/opt/Android-SDK/ndk-bundle/build/core/add-application.mk:178: *** Android NDK: APP_STL gnustl_shared 不再受支持。请切换到 c++_static 或 c++_shared。有关更多信息,请参阅 https://developer.android.com/ndk/guides/cpp-support.html。. 停止。
My machine is Ubuntu 18 and it has android SDK, NDK full. Plsease help me fix this issue. Thank all!
我的机器是 Ubuntu 18,它有 android SDK,完整的 NDK。请帮我解决这个问题。谢谢大家!
UpdateIf I replaced gnustl_shared with either c++_static or c++_shared, it shows more error:
更新如果我用 c++_static 或 c++_shared 替换 gnustl_shared,它会显示更多错误:
Build command failed.
Error while executing process /home/ndqa/opt/Android-SDK/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/Android.mk NDK_APPLICATION_MK=/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-23 NDK_OUT=/home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib APP_PLATFORM=android-21 -j10 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/protobuf-3.6.1
rm -f /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/*
rm -f /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdbserver
rm -f /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup
mkdir -p /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a
echo [armeabi-v7a] "Gdbserver ": "[arm-linux-androideabi] /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdbserver"
install -p /home/ndqa/opt/Android-SDK/ndk-bundle/prebuilt/android-arm/gdbserver/gdbserver /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdbserver
echo [armeabi-v7a] "Gdbsetup ": "/home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup"
echo "set solib-search-path /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a" > /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup
echo "directory /home/ndqa/opt/Android-SDK/ndk-bundle/sysroot /home/ndqa/opt/Android-SDK/ndk-bundle/sources/android/support /home/ndqa/opt/Android-SDK/ndk-bundle/sources/cxx-stl/llvm-libc++ /home/ndqa/opt/Android-SDK/ndk-bundle/sources/cxx-stl/llvm-libc++abi/include /home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/protobuf-3.6.1/src/ /home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/include /home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/protobuf-3.6.1/android/include /home/ndqa/opt/Android-SDK/ndk-bundle/sources/cxx-stl/llvm-libc++/include" >> /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/lib/armeabi-v7a/gdb.setup
mkdir -p /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/main
echo [armeabi-v7a] "Compile++ arm ": "main <= AndroidJni.cpp"
/home/ndqa/opt/Android-SDK/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -MMD -MP -MF /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/main/AndroidJni.o.d -target armv7-none-linux-androideabi21 -ffunction-sections -fdata-sections -funwind-tables -no-canonical-prefixes -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-exceptions -fno-rtti -gcc-toolchain /home/ndqa/opt/Android-SDK/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -fpic -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -O0 -UNDEBUG -fno-limit-debug-info -I/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/protobuf-3.6.1/src/ -I/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/include -I/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/protobuf-3.6.1/android/include -I/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/protobuf-3.6.1/src -I/home/ndqa/opt/Android-SDK/ndk-bundle/sources/cxx-stl/llvm-libc++/include -I/home/ndqa/opt/Android-SDK/ndk-bundle/sources/cxx-stl/llvm-libc++abi/include -I/home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp -std=c++11 -DANDROID -D GOOGLE_PROTOBUF_NO_RTTI=1 -D GOOGLE_PROTOBUF_NO_RTTI=1 -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -std=c++11 -std=c++11 -std=gnu++11 --sysroot /home/ndqa/opt/Android-SDK/ndk-bundle/sysroot -isystem /home/ndqa/opt/Android-SDK/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -c /home/ndqa/Documents/PROJ/code/MyProj/app/src/main/cpp/AndroidJni.cpp -o /home/ndqa/Documents/PROJ/code/MyProj/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/main/AndroidJni.o
回答by facexxyz
- switch
APP_STL := gnustl_static
to eitherc++_static
orc++_shared
in fileApplication.mk
- 切换
APP_STL := gnustl_static
到c++_static
或c++_shared
在文件中Application.mk
APP_STL := c++_static
APP_STL := c++_static
- The Android OS switched to clang several years ago. Future versions of the NDK will remove GCC, so the sooner you start testing your project with clang the better!
- 几年前,Android 操作系统切换到 clang。NDK 的未来版本将删除 GCC,因此您越早开始使用 clang 测试您的项目越好!
For ndk-build, remove lines setting NDK_TOOLCHAIN or NDK_TOOLCHAIN_VERSION.
For cmake, remove lines setting ANDROID_TOOLCHAIN.
For standalone toolchains, use the clang/clang++ binaries instead of gcc/g++.
For other build systems, ask the owners of that build system.
对于 ndk-build,删除设置 NDK_TOOLCHAIN 或 NDK_TOOLCHAIN_VERSION 的行。
对于 cmake,删除设置 ANDROID_TOOLCHAIN 的行。
对于独立工具链,请使用 clang/clang++ 二进制文件而不是 gcc/g++。
对于其他构建系统,请询问该构建系统的所有者。
see more details:
查看更多详情: