question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't Pass ANDROID_KEYSTORE_PASS To Unity Builder Script

See original GitHub issue

Bug description

No matter what I try, I’m unable to pass ANDROID_KEYSTORE_PASS to my Unity builder script.

How to reproduce

See the following config & code:

.github/workflows/main.yml:

     - uses: game-ci/unity-builder@v2
        env:
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
          UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
          androidKeystoreName: user.keystore
          androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
          androidKeystorePass: ${{ secrets.ANDROID_KEYSTORE_PASS }}
          androidKeyaliasName: ${{ secrets.ANDROID_KEYALIAS_NAME }}
          androidKeyaliasPass: ${{ secrets.ANDROID_KEYALIAS_PASS }}

Assets/Editor/AndroidBuilder.cs:

public class AndroidBuilder
{
    static void ProductionBuild()
    {
        foreach(DictionaryEntry e in System.Environment.GetEnvironmentVariables())
        {
            Debug.LogError("Env: " + e.Key  + ":" + e.Value);
        }
        
        string[] scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(s => s.path).ToArray();
        var buildPlayerOptions = new BuildPlayerOptions
        {
            scenes = scenes,
            target = BuildTarget.Android,
            locationPathName = "build/Build.apk",
        };

        BuildPipeline.BuildPlayer(buildPlayerOptions);
    }
} 
 

Output spits out a bunch of environment variables, notably:

Env: UNITY_EMAIL:*** Env: UNITY_PASSWORD:*** Env: UNITY_SERIAL:*** Env: ANDROID_KEYSTORE_BASE64: Env: ANDROID_KEYSTORE_PASS: Env: ANDROID_KEYALIAS_NAME: Env: ANDROID_KEYALIAS_PASS:

(Notice the 4 bottom ones are empty)

The final APK isn’t produced and has the error message:

UnityException: Can not sign the application
Unable to sign the application; please provide passwords!

Expected behavior

ANDROID_KEYSTORE_PASS is populated so an APK can be signed

Additional details

I’ve tried so many things. Notably, manually setting the password in AndroidBuilder.cs

        PlayerSettings.keystorePass = "Password123";

Builds the APK no problem, indicating the rest of my code works. Any suggestions?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
webbertakkencommented, Sep 7, 2022

the fix was to explicitly pass secrets from the parent job

@lebek As far as I know GitHub does not have a hierarchy in it’s jobs. What do you mean by parent job. Would you mind editing your post to include the incorrect example as well, so we can see the difference?

Edit: I see, the job is used to call a reusable workflow. In that case you can also inherit the secrets (see docs).

jobs:
  pass-secrets-to-workflow:
    uses: ./.github/workflows/called-workflow.yml
    secrets: inherit
0reactions
lebekcommented, Sep 7, 2022

Edit: I see, the job is used to call a reusable workflow. In that case you can also inherit the secrets (see docs).

Even better 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Script not working in build - ok in editor - Unity Forum
Build your game, in the [name]_Data folder look at the file called Assembly-UnityScript.dll and take a peek at the "Date Modified".
Read more >
game-ci/unity - CircleCI Developer Hub
Easily build and test Unity projects. The project artifacts and test results are stored in CircleCI and can be opened in the Workflow...
Read more >
Builder - GameCI
To pass Unity Build Options (for example, customParameters: -EnableHeadlessMode will do server builds). required: false default: "". versioning​. Configure a ...
Read more >
Reducing the file size of your build - Unity - Manual
For faster workflow in the Editor, go to Unity < Preferences and untick the checkbox for Compress Assets on Import. All Textures are...
Read more >
Using Visual Studio Tools for Unity | Microsoft Learn
You can debug development builds of Unity players with Visual Studio. Enable script debugging in a Unity player. In Unity, open the Build...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found