Issue
Since I updated to Android Studio 3.5 when ever I run the application (no matter which button I pick) first thing that happens is this error:
Build command failed.
Error while executing process Library/Android/sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /.cxx/cmake/prodDebug/arm64-v8a --target jni-lib}
[1/5] Building CXX object ../../../../mobileCore/CMakeFiles/MobileNativeCoreSharedLib.dir/LocationExpert.cpp.o
[2/5] Building CXX object ../../../../mobileCore/CMakeFiles/MobileNativeCoreSharedLib.dir/ElasticGPS.cpp.o
[3/5] Building CXX object ../../../../mobileCore/CMakeFiles/MobileNativeCoreSharedLib.dir/GRRunnableHandler.cpp.o
[4/5] Linking CXX shared library ../../../../build/intermediates/cmake/prodDebug/obj/arm64-v8a/libMobileNativeCoreSharedLib.so
FAILED: : && /android-ndk-r16/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android --gcc-toolchain=/android-ndk-r16/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64 --sysroot=/android-ndk-r16/sysroot -fPIC -isystem /android-ndk-r16/sysroot/usr/include/aarch64-linux-android -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a --sysroot /android-ndk-r16/platforms/android-21/arch-arm64 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libMobileNativeCoreSharedLib.so -o ../../../../build/intermediates/cmake/prodDebug/obj/arm64-v8a/libMobileNativeCoreSharedLib.so ../../../../mobileCore/CMakeFiles/MobileNativeCoreSharedLib.dir/LocationExpert.cpp.o ../../../../mobileCore/CMakeFiles/MobileNativeCoreSharedLib.dir/ElasticGPS.cpp.o ../../../../mobileCore/CMakeFiles/MobileNativeCoreSharedLib.dir/GRRunnableHandler.cpp.o ../../../../mobileCore/CMakeFiles/MobileNativeCoreSharedLib.dir/DistanceCalculator.cpp.o ../../../../mobileCore/CMakeFiles/MobileNativeCoreSharedLib.dir/Logger.cpp.o -llog -latomic -lm "/android-ndk-r16/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/libgnustl_static.a" && :
../../../../mobileCore/CMakeFiles/MobileNativeCoreSharedLib.dir/DistanceCalculator.cpp.o: error adding symbols: File in wrong format
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
--- Some folder names/user names were omitted ---
Only after I "Refresh linked C++ projects" / "Clean project", the application will then compile, build and install on the device.
This started happening only after upgrading AS to 3.5.
Any clues why? Thank you!
Solution
So eventually I gathered that building for arm64-v8a during debug has stopped functioning correctly for some reason in AS 3.5.
So as a fix for release builds, I simply use
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64
}
and
ndk {
abiFilters 'armeabi-v7a', 'x86', 'x86_64
}
for debug builds heh.
Perhaps, some day, I'll look into the exact reason why 'arm64-v8a' fails. Anyway, this solved the problem for me :)
Answered By - Alon Minski
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.