Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NDK, CMake, and Android in TravisCI

Tags:

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 achieving this by pulling the NDK myself, however my CI box is complaining about the CMake license not being accepted. The weird thing is that I thought this was included in the android-sdk-license which I am already including in my build. My travis YAML looks like this:

language: android

jdk:
  - oraclejdk8
  - oraclejdk9

android:
  components:
    - tools
    - platform-tools
    - tools
    - build-tools-26.0.2
    - android-26
    - extra-android-m2repository
    - extra-google-m2repository
    - extra-android-support
    - extra-google-google_play_services
    - add-on
    - extra

licenses:
  - 'android-sdk-preview-license-.+'
  - 'android-sdk-license-.+'

before_script:
  - wget https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip
  - unzip -qq android-ndk-r16b-linux-x86_64.zip
  - export ANDROID_NDK_HOME=`pwd`/android-ndk-r16b
  - export LOCAL_ANDROID_NDK_HOME="$ANDROID_NDK_HOME"
  - export LOCAL_ANDROID_NDK_HOST_PLATFORM="linux-x86_64"
  - export PATH=$PATH:${ANDROID_NDK_HOME}
  - env

script: ./gradlew build jacocoTestReport

matrix:
  fast_finish: true
  allow_failures:
    - jdk: oraclejdk9

notifications:
  email: false

after_success:
  — bash <(curl -s https://codecov.io/bash)

The license error can be seen at the bottom of the build here

like image 232
jhole89 Avatar asked Dec 12 '17 22:12

jhole89


2 Answers

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.

like image 132
Roberto Leinardi Avatar answered Oct 15 '22 10:10

Roberto Leinardi


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

like image 28
Dan Albert Avatar answered Oct 15 '22 10:10

Dan Albert