Android 与 github 操作某些许可证尚未被接受

Hus*_*hmy 0 android android-gradle-plugin github-actions

我设置了以下 github 工作流程来构建 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
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误

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
Run Code Online (Sandbox Code Playgroud)

我之前尝试过此答案yes | ~/Android/Sdk/tools/bin/sdkmanager --licenses 中的这一行,但没有收到此类文件或目录错误./gradlew build

ret*_*hab 6

在 gradle 构建步骤之前,您可能想要使用setup-android操作,因为它:

  • 下载 SDK 命令行工具
  • 接受 SDK 许可证

您可以像这样添加它:

- name: Setup Android SDK
  uses: android-actions/setup-android@v2
Run Code Online (Sandbox Code Playgroud)