Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyNotFoundException: The given key 'androidVersionCode' was not present in the dictionary. (Windows) #434

Closed
singlerider opened this issue Sep 15, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@singlerider
Copy link
Contributor

singlerider commented Sep 15, 2022

Bug description

The current Windows build script doesn't include the androidVersionCode env pass-through that both macos and linux scripts do. This, in turn causes the error you can see in our GitHub Action (also shown below).

From GitHub Actions:

KeyNotFoundException: The given key 'androidVersionCode' was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <7ab397abd13b41e3ad74fc63bc0bd4a1>:0 
  at UnityBuilderAction.Builder.BuildProject () [0x0011b] in C:\github\workspace\Assets\Editor\UnityBuilderAction\Assets\Editor\UnityBuilderAction\Builder.cs:46 

(Filename: Assets/Editor/UnityBuilderAction/Assets/Editor/UnityBuilderAction/Builder.cs Line: 46)

executeMethod method UnityBuilderAction.Builder.BuildProject threw exception.

Aborting batchmode due to failure:
executeMethod method UnityBuilderAction.Builder.BuildProject threw exception.

Exiting without the bug reporter. Application will terminate with return code 1
Build failed, with exit code False"

Regardless of the format (non-string-escaped as in the docs or string-escaped as in the examples), unity-builder lumps it into a single object.

Examples:

  • androidVersionCode: 1
  • customParameters: "-androidVersionCode 1"
  • customParameters: -androidVersionCode 1

How to reproduce

Running a job from this repository (or presumably any that uses windows) will cause this issue no matter how the androidVersionCode is passed to it.

Expected behavior

The "dictionary" value for androidVersionCode should be passed, as it is in the UNIX-like options (macos/linux) listed above:

Found flag "androidVersionCode 1" with value ""

as in this job run.

Additional details

We are running a custom Windows-based Docker image (https://hub.docker.com/layers/noenflux/editor/2022.2.0b8-android-1.0.0/images/sha256-ed170b58a35a1ac1e4a35d2357eb7e230239afa83aef2fd5057492719f4b3b3b?context=repo) to build to "Android" targets.

@singlerider singlerider added the bug Something isn't working label Sep 15, 2022
singlerider pushed a commit to singlerider/unity-builder that referenced this issue Sep 16, 2022
game-ci#434 will show that no Windows builds are currently capable of sending `androidVersionCode` or any other Android parameters. This can be fixed very simply by adjusting the build script to pass these parameters. Compare the following two files:

- https://github.com/game-ci/unity-builder/blob/cdee7d1d9a8ab9eccc408a37832b43d6afa73507/dist/platforms/windows/build.ps1#L112
- https://github.com/game-ci/unity-builder/blob/cdee7d1d9a8ab9eccc408a37832b43d6afa73507/dist/platforms/ubuntu/steps/build.sh#L138

It's clear that the current Windows build script is omitting certain parameters. This will resolve that issue (linked in commit message header).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant