How to install cmake using Android sdkmanager?

android-ndk
android

#1

You can do this with a simple Script step:

(source: https://github.com/bitrise-docker/android-ndk/pull/38#issuecomment-281309983 )

#!/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: https://github.com/bitrise-io/build.issues/issues/33


#3

For anyone having problems with CMake 3.6.4111459, use 24333f8a63b6825ea9c5514f83c2829b004d1fee as the license key instead of 8933...