Preserve the first failure
Capture the full relevant log before rebuilding repeatedly. The Unity Gradle guide explains how Unity uses Gradle for Android output, and the build manual describes export and build options.
Keep secrets and private paths redacted when sharing logs.
Classify the first meaningful error
| Error | Check |
|---|---|
| Unsupported Java version | Unity-supported toolchain and JDK compatibility |
| Duplicate classes | Android plugin/SDK overlap |
| Manifest merger failure | Plugin manifests and SDK settings |
| Keystore failure | Path, alias and credentials |
| Native linker failure | ABI, NDK and plugin binaries |
Do not replace Unity's bundled Gradle or JDK randomly; the editor version supports a particular toolchain combination.
Review custom templates
Old Gradle templates or third-party post-process scripts can preserve obsolete settings across engine upgrades. Compare them with the supported templates for the installed Unity version.
A fix applied only to an exported generated project may disappear on the next Unity build. Move the correction to the maintained source/template or plugin configuration.
Isolate the responsible plugin
When a dependency or manifest conflict is involved, identify which package introduced each input. Remove or update one component at a time in a controlled branch rather than deleting all caches and SDKs simultaneously.
Rebuild the original target
Verify the same release profile, architecture and signing path that failed. APKLint's Build Analyzer can support review of exported Gradle configuration, while the Unity Analyzer can inspect the output. Neither executes the Unity build pipeline, so retain the successful log and a device test after the correction.
Trace a duplicate class to the plugin that introduced it
Imagine a build that starts failing after an advertising plugin update. The final Unity message may only say that Gradle failed, while the earlier compiler output names a duplicate Java class. Preserve that earlier error and identify both archives containing the class. One may be an old local Android library and the other a dependency resolved by the updated plugin. Removing an unrelated scene or changing the scripting backend cannot resolve that ownership conflict.
The Unity Gradle overview explains the Android project structure used by the engine. Inspect the generated project to understand the conflicting inputs, then locate the maintained package or template that contributes each one. Prefer a supported plugin update or a documented dependency configuration over deleting arbitrary files from a generated directory.
Prove that the correction survives regeneration
Make one controlled change and generate the Android project again from Unity. If the deleted archive returns, the real source configuration still introduces it. Correct that source and repeat the same release profile. Keep a comparison of the relevant resolved dependencies so the result shows which duplicate disappeared and which implementation remains.
A different failure may appear once the first conflict is fixed. For example, a later manifest task might reject an SDK requirement introduced by the surviving plugin. Treat it as a newly reached build stage and inspect its own error; do not conclude that the original dependency correction failed merely because the entire pipeline is not green yet.
When the first error concerns Java, Gradle or the Android plugin version, check the supported combination for the installed Unity editor. A command-line build using a different JDK from the editor can produce a misleading comparison. Record the actual tool paths and versions, and ensure CI selects the same intended toolchain before comparing logs.
After the build succeeds, install the resulting candidate and exercise the plugin feature, including its unavailable-service or denied-permission state. Dependency resolution proves that classes can be packaged together; it does not prove the updated SDK initializes correctly. Preserve the final source change, generated dependency evidence and device result. That makes the repair repeatable after the next clean checkout instead of depending on an unrecorded edit in temporary output.
Sources and further reading
- Unity: Gradle for Android
- Unity: Build an Android application
- Android Developers: Java versions in Android builds
Reference review: 29 September 2026. Examples illustrate the workflow; check your installed versions, release artifact and account-specific Console requirements before applying them. This guide is not a claim that APKLint executed your project or verified your private account.


