問題
AndroidのBuild tools versionをあげたらなぜかBitriseでビルドできなくなったよ!
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とあったのですが、それだけれはだめでした。
解決方法
- まずはローカルで
sdkmanager --licenses
を実行 - ライセンスを承認するかを聞かれるのでひたすらyキーを押す
-
$ANDROID_HOME/licenses/
にライセンス情報ファイルができる - android-sdk-licenseとandroid-sdk-preview-licenseが更新されるので、これをbitriseにアップロード
- ビルドの前に、Bitrise環境の
$ANDROID_HOME/licenses/
以下に上記の2ファイルが配置されるようWorkflowを調節 - ビルドできるようになる!
どうもローカルのAndroidStudioなどでsdkをアップデートしている場合などに、ライセンス情報のファイルがアップデートされない場合があるっぽい。
なので、アップロード前に、一度sdkmanager --licenses
を実行することで、強制的にライセンス情報ファイルをアップデートするのが吉。