Skip to content

Android builds failing every now and then #736

@Edvinas01

Description

@Edvinas01

I'm running GameCI on a self-hosted GitHub runner using Unity 6000.0.47f1 to build Android builds for Meta Quest. My workflow is based on the example given here: https://game.ci/docs/github/builder#complete-example

Every now and then, my Android builds start failing due to this error:

2025-09-19T15:17:21.7480265Z FAILURE: Build failed with an exception.
2025-09-19T15:17:21.7480541Z 
2025-09-19T15:17:21.7480699Z * What went wrong:
2025-09-19T15:17:21.7481144Z Execution failed for task ':launcher:compressReleaseAssets'.
2025-09-19T15:17:21.7481654Z > Multiple task action failures occurred:
2025-09-19T15:17:21.7482310Z    > A failure occurred while executing com.android.build.gradle.internal.tasks.CompressAssetsWorkAction
2025-09-19T15:17:21.7483879Z       > Zip file '/github/workspace/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/compressed_assets/release/compressReleaseAssets/out/assets/bin/Data/15b4b090c25ed138a963c6813334b7c4.jar' already contains entry 'assets/bin/Data/15b4b090c25ed138a963c6813334b7c4', cannot overwrite
2025-09-19T15:17:21.7485427Z    > A failure occurred while executing com.android.build.gradle.internal.tasks.CompressAssetsWorkAction
2025-09-19T15:17:21.7486982Z       > Zip file '/github/workspace/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/compressed_assets/release/compressReleaseAssets/out/assets/bin/Data/28768b3ef6b47c0bcb9c5a5b19dbfa92.jar' already contains entry 'assets/bin/Data/28768b3ef6b47c0bcb9c5a5b19dbfa92', cannot overwrite

Once I get this error, every following build fails with the same message. Busting the cache fixes the issue and builds start working again Not always, today after deleting the cache twice, the build failed anyway. My cache setup in the release workflow is as follows:

build:
  name: Build
  timeout-minutes: 120

  needs:
    - initialize

  runs-on:
    - self-hosted
    - bare-metal
    - ${{ needs.initialize.outputs.runnerUsername }}

  strategy:
    matrix:
      targetPlatform: ${{ fromJSON(needs.initialize.outputs.targetPlatforms) }}

  steps:
    - name: Cache
      uses: actions/cache@v3
      with:
        path: Library
        key: Library-${{ needs.initialize.outputs.repositoryName }}-${{ matrix.targetPlatform }}-${{ hashFiles('Packages/packages-lock.json', 'Packages/manifest.json') }}
        restore-keys: |
          Library-${{ needs.initialize.outputs.repositoryName }}-${{ matrix.targetPlatform }}-
      env:
        ACTIONS_CACHE_URL: ${{ needs.initialize.outputs.actionsCacheUrl }}

    - name: Build Unity Project
      uses: game-ci/unity-builder@v4
      env:
        UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
        UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
        UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
      with:
        # Permission fix
        runAsHostUser: true

        # External deps
        gitPrivateToken: ${{ secrets.GIT_PRIVATE_TOKEN }}

        # Output dirs
        buildsPath: 'Builds'
        buildName: ${{ vars.BUILD_NAME }}

        # Platform specific
        targetPlatform: ${{ matrix.targetPlatform }}
        versioning: Custom
        version: ${{ github.event.inputs.version }}

        # Android keystore
        androidKeystoreName: ${{ secrets.KEYSTORE_NAME }}
        androidKeystoreBase64: ${{ secrets.KEYSTORE_BASE64 }}
        androidKeystorePass: ${{ secrets.KEYSTORE_PASSWORD }}
        androidKeyaliasName: ${{ secrets.KEYSTORE_ALIAS_NAME }}
        androidKeyaliasPass: ${{ secrets.KEYSTORE_ALIAS_PASSWORD }}

And the initialize step which runs once before the build step:

initialize:
  name: Initialize
  runs-on: [ 'self-hosted', 'bare-metal' ]
  timeout-minutes: 60

  outputs:
    targetBranch: ${{ steps.initGitInfo.outputs.targetBranch }}
    repositoryName: ${{ steps.initGitInfo.outputs.repositoryName }}
    targetPlatforms: ${{ steps.initBuildInfo.outputs.targetPlatforms }}
    buildLongName: ${{ steps.initBuildInfo.outputs.buildLongName }}
    actionsCacheUrl: ${{ steps.initBuildInfo.outputs.actionsCacheUrl }}
    runnerUsername: ${{ steps.initBuildInfo.outputs.runnerUsername }}
    buildChangelogFile: ${{ steps.initBuildInfo.outputs.buildChangelogFile }}

  steps:
    - name: Checkout repository with LFS
      uses: actions/checkout@v4
      with:
        fetch-depth: 0
        clean: ${{ github.event.inputs.cleanCheckout }}
        lfs: true

    - name: Initialize Git info
      id: initGitInfo
      env:
        GITHUB_REPOSITORY: ${{ github.repository }}
        GITHUB_REF: ${{ github.ref }}
      run: bash "${GITHUB_WORKSPACE}/.github/workflows/release/initialize-git-info.sh"

    - name: Initialize build info
      id: initBuildInfo
      env:
        TARGET_PLATFORMS_STRING: ${{ github.event.inputs.platforms }}
        BUILD_VERSION: ${{ github.event.inputs.version }}
        BUILD_NAME: ${{ vars.BUILD_NAME }}
        CHANGELOG_FILE: ${{ github.workspace }}/${{ vars.CHANGELOG_FILE }}
        RUNNER_NAME: ${{ runner.name }}
      run: bash "${GITHUB_WORKSPACE}/.github/workflows/release/initialize-build-info.sh"
  • Is my setup incorrect where I clone repo once before both build steps? I do this to quicken the builds.
  • What could be the cause of this error? I couldn't find much info on this online, apart from some general Gradle posts unrelated to Unity.
  • Is it true that I need to cache the entire Library folder as shown in the GameCI example? Or should I only cache certain dirs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions