Skip to content

Android code signing not working with Build Profiles #713

@smsunarto

Description

@smsunarto

Bug description

When trying to use the automatic android app bundle signing for release to Google Play, Unity keeps returning the following error even though the password (and other android secrets) is already provided.

Error: UnityException: Can not sign the application
Unable to sign the application; please provide passwords!
System.Dynamic.UpdateDelegates:UpdateAndExecute2(CallSite, Type, Object)
UnityBuilderAction.Builder:BuildProject() (at Assets/Editor/UnityBuilderAction/Assets/Editor/UnityBuilderAction/Builder.cs:113)

I've also confirmed that the android secrets are also getting passed into the CLI

COMMAND LINE ARGUMENTS:
C:\UnityEditor\6000.1.5f1\Editor\Unity.exe
-quit
-batchmode
-nographics
-silent-crashes
-customBuildName
<redacted>
-projectPath
c:/github/workspace\.
-executeMethod
UnityBuilderAction.Builder.BuildProject
-buildTarget
Android
-customBuildTarget
Android
-customBuildPath
<redacted>
-customBuildProfile
<redacted>
-buildVersion
0.0.1006
-androidVersionCode
1006
-androidKeystorePass
***
-androidKeyaliasName
***
-androidKeyaliasPass
***
-androidTargetSdkVersion
-androidExportType
androidAppBundle
-androidSymbolType
none
-logfile

How to reproduce

  build-windows-runner:
    timeout-minutes: 30
    needs: check-commits
    if: needs.check-commits.outputs.has_new_commits == 'true'
    strategy:
      fail-fast: false
      matrix:
        include:
          - targetPlatform: StandaloneWindows64
            buildName: <redacted>
            buildProfile: <redacted>
            artifactName: <redacted>
          - targetPlatform: Android
            buildName: <redacted>
            buildProfile: <redacted>
            artifactName: <redacted>

    name: Build (${{ matrix.targetPlatform }})
    runs-on: unity-runner-windows
    env:
      UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_2 }}
      UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_2 }}
      UNITY_SERIAL: ${{ secrets.UNITY_SERIAL_2 }}

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          lfs: true

      - uses: actions/cache@v4
        with:
          path: Library
          key: Library-${{ matrix.targetPlatform }}
          restore-keys: |
            Library-${{ matrix.targetPlatform }}
            Library-

      - name: Build with Unity
        uses: game-ci/unity-builder@v4
        with:
          targetPlatform: ${{ matrix.targetPlatform }}
          buildName: ${{ matrix.buildName }}
          buildProfile: ${{ matrix.buildProfile }}
          buildsPath: build
          versioning: Semantic
          allowDirtyBuild: true
          # Android-specific parameters from original snippet
          androidKeystoreName: user
          androidExportType: androidAppBundle
          androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
          androidKeystorePass: ${{ secrets.ANDROID_KEYSTORE_PASS }}
          androidKeyaliasName: ${{ secrets.ANDROID_KEYALIAS_NAME }}
          androidKeyaliasPass: ${{ secrets.ANDROID_KEYALIAS_PASS }}

      - name: Setup Ruby
        if: success() && matrix.targetPlatform == 'Android'
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.2'

      - name: Release to Google Play (Android)
        if: success() && matrix.targetPlatform == 'Android'
        env:
          GOOGLE_PLAY_KEY_FILE: ${{ secrets.GOOGLE_PLAY_KEY_FILE }}
          GOOGLE_PLAY_KEY_FILE_PATH: ${{ github.workspace }}/fastlane/google-fastlane.json
          ANDROID_BUILD_FILE_PATH: build/Android/${{ matrix.artifactName }}.aab
          ANDROID_PACKAGE_NAME: <redacted>
        run: |
            echo "$GOOGLE_PLAY_KEY_FILE" > $GOOGLE_PLAY_KEY_FILE_PATH            
            bundle install
            bundle exec fastlane android internal

      - uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.artifactName }}
          path: build/${{ matrix.targetPlatform }}
          retention-days: 7

Expected behavior

Should be able to sign without issue

Additional details

Windows 2022 runner

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions