Android build fails in Unity Build Automation
Resolve Android build failures in Unity Build Automation and identify common causes.
Read time 1 minuteLast updated 10 months ago
Symptoms
- Android builds fail for an unclear reason.
- Android builds fail and other targets build correctly.
- Android builds fail in UBA but work locally.
Cause
Unity Build Automation runs the Unity Editor in to execute your builds, and uses the default Android tools (JDK/SDK) to complete them. When your Android build fails in the service but works locally or other targets seem to work correctly, the root cause is often incompatible Android tools.
batchmodeFailures due to Android tool often have the message in the logs. Gradle is the build system that Unity uses for Android builds.
Gradle Build failedResolution
The first step to resolve this issue is to ensure you can build your project locally in batch mode with the following tool versions:
- The Unity Editor.
- The JDK (the default version that ships with the chosen version of the Editor).
- The Android SDK (either the default version or as specified in your advanced target configuration).
You also need to validate the version of Gradle that you use.
If your project does build locally, take note of the versions of the tools you used and ensure they match with the versions you use in the Unity Build Automation service. To check your local version of Gradle you can use the command in the terminal.
gradle --versionIf your build works locally in but fails in the Unity Build Automation service with the same tools and versions, please open a support ticket so the support team can investigate further. To submit a ticket from the Unity Dashboard, open DevOps and select Help & Support > Ticket > File a ticket.
batchmode