game-ci / unity-builder

Build Unity projects for different platforms
https://github.com/marketplace/actions/unity-builder
MIT License
857 stars 253 forks source link

Crash when building Android through Docker #604

Closed Rycieos closed 11 months ago

Rycieos commented 1 year ago

Bug description Building an Android player crashes when trying to set up the Android SDK. I think this was caused by this commit: https://github.com/game-ci/unity-builder/commit/8ca1282c9eabf4b053576f63611d21ee855b80db This is the line it crashes on: https://github.com/game-ci/unity-builder/blob/bbd713b05afb7069db7168195cb74a904966487f/dist/platforms/ubuntu/entrypoint.sh#L19-L20 I confirmed that the file /opt/unity/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools does not exist in the container.

How to reproduce

Observed behavior

/usr/bin/docker run --workdir /github/workspace --rm 
[redacted]
--cpus=4 --memory=15183m unityci/editor:ubuntu-2020.3.44f1-android-3 /bin/bash -c /entrypoint.sh
Unable to find image 'unityci/editor:ubuntu-2020.3.44f1-android-3' locally
ubuntu-2020.3.44f1-android-3: Pulling from unityci/editor
...
51d9c7c758c0: Pull complete
Digest: sha256:98455f373bc9d575db6735f280af7de9610d94b80817c18cf3d6417fc4f02611
Status: Downloaded newer image for unityci/editor:ubuntu-2020.3.f1-android-3
find: ‘/opt/unity/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools’: No such file or directory
No sdkmanager found
Error: Build failed with exit code 1

Expected behavior

Build does not crash before even starting.

Additional details

I do not think running on a self-hosted runner is relevant, but in case it is, I can provide any details about the host.

szymmirr commented 1 year ago

Can confirm, I ran into the same issue.

AndrewKahr commented 1 year ago

I think the issue is probably from this commit: https://github.com/game-ci/unity-builder/commit/6419c8742b5fa6df0f12a11e1a1554cb34168538

Looks like it was changed for new versions but I guess the old versions don't have the same path

Lokhandwalah commented 1 year ago

I m also facing the same issue when building on ubuntu but works on windows

JayMehta97 commented 12 months ago

I am also facing the same issue on self-hosted ubuntu machine when building using docker image unityci/editor:ubuntu-2020.3.17f1-android-3.0.0. Any alternate solutionfor this?

Rycieos commented 12 months ago

My current workaround was to revert to version v3 of this action.

AndrewKahr commented 12 months ago

I just pushed a potential fix to game-ci/unity-builder@fix-sdkmgr. Can someone test this out and let me know if it is fixed?

Rycieos commented 12 months ago

I tested that branch with Unity version 2020.3.44f1 (same as initially reported), and it works.

At least, it no longer crashes on finding SDK manager. The build still crashed, but I think for an unrelated reason. I will update once I know why.

Rycieos commented 12 months ago

Confirmed: unrelated issue. Patch looks good.

AndrewKahr commented 11 months ago

Should be fixed in the latest v4 release so closing this issue