I\'m trying to set up my CI for a Android project that uses some C++ code. As such I need the NDK that doesn\'t come pre-installed on Travis Android images. I\'m currently
This is currently working for me:
install:
- echo y | sdkmanager 'ndk-bundle'
- echo y | sdkmanager 'cmake;3.6.4111459'
- echo y | sdkmanager 'lldb;3.0'
My .travis.yml is available here.
I didn't try it but perhaps it's similar to the constraint library related issue.
As explained here and here, use a workaround to solve license issues or directly download it:
is there any solution without workaround using export license?
Yes, you can use the new sdkmanager
to install the constraint library and accept the license:
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"
In your case, check the correct version for cmake
like here and here, cmake;3.6.4111459
:
- sdkmanager --list || true
- echo yes | sdkmanager "cmake;3.6.4111459"
Otherwise, the missing component will be detected by gradle
and downloaded without accept it:
# Show version and download Gradle Wrapper if it's not already cached
- ./gradlew --version
# Clean project and download missing dependencies and components
- ./gradlew clean build
In that case, as explained here, you need to accept the license the first time via the workaround:
In your
.travis.yml
file add:before_install: - mkdir "$ANDROID_HOME/licenses" || true - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license" - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
Do not forgot to accept all the licences on the main
android
object:android: components: # ... licenses: - android-sdk-license-.+ - '.+'
Before android script deprecation, you can accept all the licenses at the same time like this:
# THE SETUP STAGE
# ---------------
# If you comment out this section, Travis CI will install for you the components you define here.
# Check your project requirements and the components included by default on Travis-ci VM images.
# Check required: https://github.com/google/iosched/blob/master/doc/BUILDING.md
# Check defaults: http://docs.travis-ci.com/user/languages/android/#Pre-installed-components
android:
components:
# Check Android SDK tools: http://developer.android.com/tools/sdk/tools-notes.html
# Check Android SDK Platform-tools: http://developer.android.com/tools/revisions/platforms.html
# Comment the lines below if the latest revisions of Android SDK Tools are included by default.
# - tools
# - platform-tools
# ...
licenses:
# Check licenses: http://docs.travis-ci.com/user/languages/android/#Dealing-with-Licenses
# By default Travis will accept all the licenses, but it's also possible to define a white list:
# White list current android-sdk-license revision.
# - 'android-sdk-license-5be876d5'
# White list all android-sdk-license revisions.
# - 'android-sdk-license-.+'
# White list all the licenses.
- '.+'
I think that if you remove licenses section, 'white list all the licenses' - '.+'
is applied by default.
Looks like the NDK samples use travis, maybe look there to see what's missing from your build: https://github.com/googlesamples/android-ndk/blob/master/.travis.yml