I ran into this problem when writing a audio-related app:
Build command failed. Error while executing process C:\Android_SDK\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\workspace\AndroidAudioNDK\app\.externalNativeBuild\cmake\debug\x86_64 --target native-lib} [1/1] Linking CXX shared library ..\..\..\..\build\intermediates\cmake\debug\obj\x86_64\libnative-lib.so FAILED: cmd.exe /C "cd . && C:\android-ndk-r15c\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=x86_64-none-linux-android --gcc-toolchain=C:/android-ndk-r15c/toolchains/x86_64-4.9/prebuilt/windows-x86_64 --sysroot=C:/android-ndk-r15c/sysroot -fPIC -isystem C:/android-ndk-r15c/sysroot/usr/include/x86_64-linux-android -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -fexceptions -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a --sysroot C:/android-ndk-r15c/platforms/android-21/arch-x86_64 -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,libnative-lib.so -o ..\..\..\..\build\intermediates\cmake\debug\obj\x86_64\libnative-lib.so CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o -llog -lm "C:/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/libgnustl_static.a" && cd ." D:\workspace\AndroidAudioNDK\app\src\main\cpp/native-lib.cpp:35: error: undefined reference to 'AAssetManager_fromJava' D:\workspace\AndroidAudioNDK\app\src\main\cpp/native-lib.cpp:35: error: undefined reference to 'AAssetManager_open' D:\workspace\AndroidAudioNDK\app\src\main\cpp/native-lib.cpp:35: error: undefined reference to 'AAsset_openFileDescriptor' D:\workspace\AndroidAudioNDK\app\src\main\cpp/native-lib.cpp:44: error: undefined reference to 'AMediaExtractor_new' ... And I found a solution to this problem: adding the android lib to LOCAL_LDLIBS, but How to do that in the latest android studio (3.1.3)? I have tried the other solutions under that answer but none of them works for me: the build error persists.
