本文介绍了TravisCI中的NDK,CMake和Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为使用某些C ++代码的Android项目设置CI.因此,我需要未预先安装在Travis Android映像上的NDK.我目前正在通过自己拉NDK来实现此目的,但是我的CI框抱怨CMake许可证未被接受.奇怪的是,我认为这已包含在我的构建中已经包含的android-sdk-license中.我的travis YAML看起来像这样:

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

推荐答案

当前为我工作:

install:
  - echo y | sdkmanager 'ndk-bundle'
  - echo y | sdkmanager 'cmake;3.6.4111459'
  - echo y | sdkmanager 'lldb;3.0'

可以在此处获得我的.travis.yml.

My .travis.yml is available here.

这篇关于TravisCI中的NDK,CMake和Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 19:22