game-ci / game-ci/documentation

Automate detection of proxy variables for android build

Open
#405 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
MDX
Stars
243
Forks
130
Avg merge
15d 42m
Merged PRs (30d)
1

Description

**Context**

Unity is pretty stupid when it comes to building for android behind a proxy (without any access to the internet without the proxy). See also this thread:

https://forum.unity.com/threads/request-proxy-settings-for-unity-hub.515447/

One needs to edit the sdkmanager script file directly in order to make it work, no environment variable setting works for passing those proxy variables into the sdkmanager that is called during the android build.

Android builds behind a proxy _eventually_ succeed but it takes roughly 6 times longer (60 minutes vs 11) with all the extra time spent waiting for connection timeouts.

**Suggested solution**

Add the following to the Dockerfile for Unity:

```
find /opt/unity -name "sdkmanager" -exec sed -i 's/APP_ARGS"/APP_ARGS" ${SDKMANAGER_PROXY}/' {} \;
```

Also add something to the init files for android that does:
```
if [ -z ${PROXY_HOST+x} ]; then
export SDKMANAGER_PROXY="--proxy=http --proxy_host="\$PROXY_HOST" --proxy_port="\$PROXY_PORT"
fi
```

If you'd like I can provide a pull request that does both of these things.

**Considered alternatives**

Manually doing that, which is what we are doing now.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.