[英]Travis-CI build failed, “You have not accepted the license agreements”
I have the following Travis-CI configuration: 我有以下Travis-CI配置:
language: android
jdk: oraclejdk8
android:
components:
- build-tools-22.0.1
- android-22
- extra-google-m2repository
before_install:
- openssl aes-256-cbc -K $encrypted_8bf9e2e639dc_key -iv $encrypted_8bf9e2e639dc_iv
-in secrets.tar.enc -out secrets.tar -d
- tar xvf secrets.tar
- chmod +x gradlew
When it tries to build i get the following error: 当它试图建立我得到以下错误:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
[ConstraintLayout for Android 1.0.0-alpha7, Solver for ConstraintLayout 1.0.0-alpha7].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 17.927 secs
The command "./gradlew build connectedCheck" exited with 1.
Done. Your build exited with 1.
Now, from what the travis documentation says, travis accepts all licenses by default, so this should not be happening. 现在,根据travis文档所说的,travis默认接受所有许可,所以这不应该发生。
Is there any way to resolve this? 有什么方法可以解决这个问题吗?
Another option for accepting all licenses is the following: 接受所有许可的另一个选择如下:
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"
You can find more on this here: 你可以在这里找到更多:
Fixed this by removing the ConstraintLayout dependency from gradle since i didn't use the ConstraintLayout anyways. 通过从gradle中删除ConstraintLayout依赖项来解决此问题,因为我还没有使用ConstraintLayout。 It seems that Travis does not detect / accept the license for the ConstraintLayout.
似乎Travis没有检测到/接受ConstraintLayout的许可证。
@schnatterer's answer was very close. @schnatterer的回答非常接近。 I just couldn't get SDK 27 to work without accepteting these licenses:
我无法在不接受这些许可的情况下使SDK 27工作:
before_install:
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n504667f4c0de7af1a06de9f4b1727b84351f2910" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
This adds the old and new (26.0.2+) SDK license sha1 这会添加旧的和新的(26.0.2+)SDK许可证sha1
Explanation: 说明:
The Android SDK requires you to accept their license agreements. Android SDK要求您接受其许可协议。 Therefore it expects files in
$ANDROID_HOME/licenses
with the name of the license. 因此,它期望
$ANDROID_HOME/licenses
文件具有$ANDROID_HOME/licenses
的名称。 The content of the file are sha1 hashes (I guess) of the accepted agreements versions (a hash each line). 该文件的内容是sha1哈希(我猜)接受的协议版本(每行哈希)。 A technical way of saying I understand and accept this SPECIFIC version of the license agreements.
一种技术方式,说明我理解并接受此特定版本的许可协议。 From time to time the agreements change, so a SDK update might require to add/replace a new hash.
协议有时会发生变化,因此SDK更新可能需要添加/替换新的哈希。
You can accept all licenses that you have accepted on your local machine by exporting license files 您可以通过导出许可证文件接受在本地计算机上接受的所有许可证
licenses
folder from android SDK dir to your repo (let's name it android-licenses
for example) licenses
文件夹复制到您的仓库(例如,将其命名为android-licenses
) .travis.yml
file under before_script:
section before_script:
section下的.travis.yml
文件中 - mkdir -p "$ANDROID_HOME/licenses" - cp ./android-licenses/ "$ANDROID_HOME/licenses/"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.