You can do this with a simple Script step:
(source: Remove pre-installed CMake by viktorbenei · Pull Request #38 · bitrise-io/android-ndk · GitHub )
#!/bin/bash
set -ex
mkdir -p "${ANDROID_HOME}/licenses"
echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > "${ANDROID_HOME}/licenses/android-sdk-license"
"${ANDROID_HOME}/tools/bin/sdkmanager" --list | grep cmake | tail -n 1 | cut -d \| -f 1 | xargs "${ANDROID_HOME}/tools/bin/sdkmanager"
Note: gradlew
can install cmake
automatically, you don’t need this script if you build your Android NDK project with gradle(w)
!
All you have to do in that case is providing the license (e.g. with:
mkdir -p "${ANDROID_HOME}/licenses"
echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > "${ANDROID_HOME}/licenses/android-sdk-license"
if you use CMake 3.6.3155560
, or just copy your own license as described at http://devcenter.bitrise.io/android/frequent-android-issues/#alternative-solution-for-the-license-error) for the android ndk cmake.
Related discussion: [Android-Build NDK] CMake license problem · Issue #33 · bitrise-io/build.issues · GitHub