我正在尝试为使用某些C ++代码的Android项目设置CI。因此,我需要在Travis Android映像上预先安装的NDK。我现在通过自己拉NDK实现这一目标,但我的CI盒子抱怨CMake许可证未被接受。奇怪的是,我认为这包含在我已经包含在我的构建中的android-sdk-license中。我的travis YAML看起来像这样:
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)
可以在构建here
的底部看到许可证错误答案 0 :(得分:2)
目前这对我有用:
install:
- echo y | sdkmanager 'ndk-bundle'
- echo y | sdkmanager 'cmake;3.6.4111459'
- echo y | sdkmanager 'lldb;3.0'
我的.travis.yml可用here。
答案 1 :(得分:0)
看起来NDK示例使用travis,也许在那里查看构建中缺少的内容:https://github.com/googlesamples/android-ndk/blob/master/.travis.yml
答案 2 :(得分:0)
我没有尝试过,但也许它与约束库相关的问题类似。
正如here和here所述,使用解决方法解决许可问题或直接下载:
是否有任何解决方案没有使用导出许可证的解决方法?
是的,您可以使用新的sdkmanager
至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"
在您的情况下,请检查cmake
和here,cmake;3.6.4111459
{/ 1}}的{{1}}的正确版本:
- sdkmanager --list || true
- echo yes | sdkmanager "cmake;3.6.4111459"
否则,gradle
将检测到缺失的组件,并在不接受的情况下下载:
# 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
在这种情况下,正如here所解释的那样,您需要通过变通方法第一次接受许可证:
在
.travis.yml
文件中添加: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"
不要忘记接受主
android
对象上的所有许可证:android: components: # ... licenses: - android-sdk-license-.+ - '.+'
在Android脚本弃用之前,您可以同时接受所有许可,例如here:
# 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.
- '.+'
我认为如果删除许可证部分,默认情况下会应用“白名单所有许可证”- '.+'
。