执行cmd, 检测 ndk 是否配置环境, 类似java_sdk 配置
CmakeList.txt
编译出错:
检测 c 文件路径是否正确
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/native-lib.cpp )
找不到该 源函数
UnsatisfiedLinkError: No implementation found for int com.example.ht.cmakendk.MainActivity.getInt(int, int) (tried Java_com_example_ht_cmakendk_MainActivity_getInt and Java_com_example_ht_cmakendk_MainActivity_getInt__II)
at com.example.ht.cmakendk.MainActivity.getInt(Native Method)
在该函数上方添加
extern "C"