I have updated the Android Studio to the latest updates and since then the NDK is throwing an error. Before the update, everything was building smoothly. I have no idea about the error. If someone can help. Thanks.
Build command failed. Error while executing process /Users/blabla/Library/Android/sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /Users/blabla/AndroidStudioProjects/blablanow/mblabla/.externalNativeBuild/cmake/individualDebug/x86 --target mblabla} [1/1] Linking CXX shared library ../../../../build/intermediates/cmake/individual/debug/obj/x86/libmblabla.so FAILED: : && /Users/blabla/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=i686-none-linux-android --gcc-toolchain=/Users/blabla/Library/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/darwin-x86_64 --sysroot=/Users/blabla/Library/Android/sdk/ndk-bundle/sysroot -fPIC -isystem /Users/blabla/Library/Android/sdk/ndk-bundle/sysroot/usr/include/i686-linux-android -D__ANDROID_API__=19 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot /Users/blabla/Library/Android/sdk/ndk-bundle/platforms/android-19/arch-x86 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -L/Users/blabla/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libmblabla.so -o ../../../../build/intermediates/cmake/individual/debug/obj/x86/libmblabla.so CMakeFiles/mblabla.dir/src/main/jni/mblabla_main.cpp.o CMakeFiles/mblabla.dir/src/main/jni/mblablaJNI.cpp.o CMakeFiles/mblabla.dir/src/main/jni/Constants.cpp.o -llog -latomic -lm "/Users/blabla/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/libgnustl_static.a" && : /Users/blabla/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/stdexcept:136: error: undefined reference to 'std::logic_error::logic_error(char const*)' /Users/blabla/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/stdexcept:136: error: undefined reference to 'std::logic_error::logic_error(char const*)' clang++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed.
In order to downgrade your ndk, you will have to pull it from the internet with wget and move it into your Android SDK dir: wget https://dl.google.com/android/repository/android-ndk-r13b-darwin-x86_64.zip. unzip android-ndk-r13b-darwin-x86_64. zip.
The NDK allows Android application developers to include native code in their Android application packages, compiled as JNI shared libraries. See the Getting Started Guide for an introduction. See the changelist for a list of changes since the previous release.
As the comment says (leaving an actual answer for better visibility), see https://groups.google.com/d/topic/android-ndk/3iKT-kLEGpY/discussion.
It seems like CMake isn't updating everything it ought to.
With Studio, the easiest way to resolve this is to follow the advice left by gjs:
- eventually resolved ok after doing 'Refresh Linked C++ Projects' from the Android Studio Build Menu.
If using CMake outside of Studio: purge your build directory.
Only worked for me with:
rm -rf app/.externalNativeBuild
Refresh linked C++ Project
Ctrl+F9
)this fixed the next ndk 17 error:
stdexcept:136: error: undefined reference to 'std::logic_error:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With