Skip to content

Automate detection of proxy variables for android build #405

Open
@Blackclaws

Description

@Blackclaws

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions