LoginSignup
3

More than 5 years have passed since last update.

BitriseでAndroidのビルド時にライセンスエラーが出る問題に対する解決

Posted at

問題

AndroidのBuild tools versionをあげたらなぜかBitriseでビルドできなくなったよ!

build.gradle
buildToolsVersion "26.0.2"

みたいな設定をしたプロジェクトをBitriseでビルドしようとすると

Checking the license for package Android SDK Build-Tools 26.0.2 in /opt/android-sdk-linux/licenses
Warning: License for package Android SDK Build-Tools 26.0.2 not accepted.
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:
[Android SDK Build-Tools 26.0.2].
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

みたいなエラーがでてビルドできません。

BitriseCIでAndroidSDKのライセンスエラー
こちらのページにライセンス情報をBitriseにアップすればOKとあったのですが、それだけれはだめでした。

解決方法

  1. まずはローカルでsdkmanager --licensesを実行
  2. ライセンスを承認するかを聞かれるのでひたすらyキーを押す
  3. $ANDROID_HOME/licenses/にライセンス情報ファイルができる
  4. android-sdk-licenseとandroid-sdk-preview-licenseが更新されるので、これをbitriseにアップロード
  5. ビルドの前に、Bitrise環境の$ANDROID_HOME/licenses/以下に上記の2ファイルが配置されるようWorkflowを調節
  6. ビルドできるようになる!

どうもローカルのAndroidStudioなどでsdkをアップデートしている場合などに、ライセンス情報のファイルがアップデートされない場合があるっぽい。
なので、アップロード前に、一度sdkmanager --licensesを実行することで、強制的にライセンス情報ファイルをアップデートするのが吉。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3