2016-12-12 12 views
3

私は、次のトラヴィス-CIの構成を有している「あなたはライセンス契約を受け入れていない」、失敗しました:トラヴィス-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 

それが構築しようとすると、私は次のエラーを取得する:

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. 

今、travisのドキュメントによると、travisはすべてのライセンスをデフォルトで受け付けているので、これは起こってはいけません。

これを解決する方法はありますか?

+0

同じではない場合はここ、いくつかの回答は https://stackoverflow.com/questions/42731625/travis-ci-failed-because-cannot-accept-license-constrain-layout/45622155 #45622155 –

答えて

2

別のOへの手順以下れるすべてのライセンスを受け入れるためのption:

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" 

あなたがここにこれに関する詳細を見つけることができます。schnattererの答え@

+0

これは、Android SDKのより新しいバージョンのsdkmanagerで行うことができます。 https://stackoverflow.com/a/48125084/274350を参照してください。 –

0

私はConstraintLayoutを使用しなかったので、これをgradleからのConstraintLayout依存関係を削除することで修正しました。 TravisはConstraintLayoutのライセンスを検出/受け入れていないようです。

0

あなたはまだあなたのレポにライセンスファイルをAndroidのSDKのディレクトリから

  1. コピーlicensesフォルダをエクスポートすることによって、あなたのローカルマシン上で受け入れられているすべてのライセンスを受け入れることができ
  2. 追加(のは、例えばandroid-licensesを名前を付けましょう) before_script:セクションの下にあなたの.travis.ymlファイル
 
    - mkdir -p "$ANDROID_HOME/licenses" 
    - cp ./android-licenses/ "$ANDROID_HOME/licenses/" 
0

は非常に近かったです。私はこれらのライセンスをacceptetingせずに動作するように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" 

これは、古いものと新しいもの(26.0.2+)SDKライセンスSHA1を追加

を説明:

Android SDKでは、ライセンス契約に同意する必要があります。したがって、ライセンスの名前を持つ$ANDROID_HOME/licensesのファイルが必要です。ファイルの内容は、合意された合意バージョン(各行がハッシュ)のsha1ハッシュです(私は推測します)。私は、この特定のバージョンのライセンス契約を理解し、それを受け入れるという技術的な方法です。契約が変更されることもありますので、SDKのアップデートでは新しいハッシュを追加/置換する必要があります。

関連する問題