I need to add C/C++ code in my Android program for which I needed LLDB, CMake, and NDK. I found LLDB and NDK in SDK manager, but CMake is missing from there. I tried manuall
For me, mac OS Android studio. in File->Project Structure-> Project, I changed Gradle version to 4.4 and Android plugin version to 3.1.0, then it gets good.
Plus, you can also change Android plugin version in gradle-> classpath 'com.android.tools.build:gradle:3.1.0'
In my case (Android Studio 3.0), there was no CMake in the "SDK Tools" tab in "Appearance & Behaviour -> System Settings -> Android SDK" options. However I noticed that in the "SDK Update sites" tab, there are only two entries, one of which (Android Repository https://dl.google.com/android/repository/repository2-1.xml) had a red mark in the "enabled" column. It read "error 407" on mouseover, which is a proxy authentication error. I had the correct proxy settings (test connection worked fine with the same repository URL), so this was very strange. Restarting android studio didn't help. So I added a new entry with the same repository and this time it worked fine and CMake appeared in the other tab. Hope this helps someone.
Check this, I think this site explains what you need:
https://codelabs.developers.google.com/codelabs/android-studio-cmake/index.html?index=..%2F..%2Findex#0
Remember to check the "What you'll need"
NDK: https://developer.android.com/ndk/downloads/index.html source: https://developer.android.com/ndk/index.html
CMake: https://cmake.org/files/v3.7/cmake-3.7.1-win64-x64.zip source: https://cmake.org/
LLDB (Just for Debian systems): http://apt.llvm.org/ source: http://lldb.llvm.org/download.html
Once you download these files, copy to your SDK folder (normally in: "C:\android-sdk\") You can localize the folder here:
Then you can continue with the previous guide after the downloads :)
For me what solved as taking off the "version" option in my gradle
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
//version was here
}
}
place path of the module where your cmake is exist
if your cmake exist in app main
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
if your cmake exist in any module
externalNativeBuild {
cmake {
path file('../modulelib/CMakeLists.txt')
}
}
where "modulelib" is your library module folder name