I\'m running into an Error when I open a new project in Android Studio from the Code Samples (Hello JIN). When the Project is opened the following:
Build com
Build -> Refresh Linked C++ Projects resolved this error for me.
I would recommend using GCC instead of clang for the time being because clang still does not contain all features. You can change your compiler by doing the following:
set(CMAKE_C_COMPILER /path-to-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-gcc)
However, the darwin-x86_64 directory only exists if you are on a Mac. If you are on another platform, just use the directory that exists under the prebuilt folder.
I encountered this problem because I set the wrong path of native-lib.cpp
. After changing
add_library(native-lib SHARED native-lib.cpp)
to
add_library(native-lib SHARED src/main/jni/native-lib.cpp)
it worked again.
By the way, this is part of my project's structure.
CMakeLists.txt
src
|__main
|___jni
|___native-lib.cpp