使用JNI時出現問題:
Error: Your project contains C++ files but it is not using a supported native build system.
Consider using CMake or ndk-build integration. For more information, go to:
https://d.android.com/r/studio-ui/add-native-code.html
Alternatively, you can use the experimental plugin:
https://developer.android.com/r/tools/experimental-plugin.html
原因:
1. 沒有建立Android.mk檔案進行庫檔案配置;
2. 沒有把Android.mk檔案添加到項目中;
解決方法:
1.切換到Android視圖
2.選擇項目或子產品,右擊,選擇Link C++ Project with Gradle
3.在Build System中選擇ndk-build,并在Project Path添加Android.mk路徑
4.完成。