Home > Mobile >  Android with github action some licences have not been accepted
Android with github action some licences have not been accepted

Time:11-23

I setuped the following github workflow to build an aab

name: upload-aab-to-play-console
on:
  push:
    branches:
      - main-kt-prod
jobs:
  build:
    runs-on: ubuntu-latest
    env:
      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: set up JDK 1.8
        id: Setup_JDK
        uses: actions/setup-java@v1
        with:
          java-version: 11
  - name: build-with-gradle
    id: build
    run: |
      chmod  x gradlew
      ./gradlew build

But I get the following error

FAILURE: Build failed with an exception.
Warning: License for package Android SDK Build-Tools 32-rc1 not accepted.
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;32.0.0-rc1 Android SDK Build-Tools 32-rc1
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
  Using Android SDK: /usr/local/lib/android/sdk

I tried this line yes | ~/Android/Sdk/tools/bin/sdkmanager --licenses from this answer right before ./gradlew build but I got no such file or directory error

CodePudding user response:

Before the gradle build step, you probably want to use the setup-android action, because it:

  • downloads the SDK commandline tools
  • accepts the SDK licenses

You can add it like so:

- name: Setup Android SDK
  uses: android-actions/setup-android@v2
  • Related