Unity Android Gradle Build Failed

Share
Workaround available Android Updated November 13, 2026Based on 3 user reportsHow we research

Quick answer

Gradle build errors in Unity Android builds usually come from mismatched JDK, SDK, or Gradle versions, duplicate libraries between plugins, or a custom Gradle template. Use the Hub-installed Android tools and read the Gradle error text.

Most likely fix: Use the Unity-installed Android tools

How to fix it

Try these in order — the most common fix is first.

  1. 1. Use the Unity-installed Android tools

    1. Open Edit > Preferences > External Tools (Unity > Settings on macOS)
    2. Tick the 'Installed with Unity (recommended)' boxes for JDK, SDK, NDK, and Gradle
    3. Reinstall Android Build Support from Unity Hub if they are missing
    Did this fix it?
  2. 2. Read the real Gradle error

    1. Open Editor.log and search for 'FAILURE: Build failed' or 'What went wrong'
    2. Fix the dependency or class named there
    Did this fix it?
  3. 3. Resolve duplicate libraries

    1. Use External Dependency Manager: Assets > External Dependency Manager > Android Resolver > Force Resolve
    2. Remove duplicate .aar or .jar files from Assets/Plugins
    Did this fix it?
  4. 4. Reset custom Gradle templates

    1. Open Project Settings > Player > Android > Publishing Settings
    2. Untick custom Gradle template options, rebuild, and re-add only what you need
    Did this fix it?
  5. 5. Set API levels

    1. Check Project Settings > Player > Other Settings for Minimum and Target API level against current Google Play requirements
    Did this fix it?

Symptoms

Console shows 'CommandInvokationFailure: Gradle build failed', 'Failed to install the following Android SDK packages', or duplicate class errors.

Why it happens

  • Android SDK, NDK or JDK pointing to a custom install instead of the Unity-bundled one
  • Gradle or Android Gradle Plugin version mismatch with the Unity version
  • Duplicate classes from multiple plugins (for example Firebase or ads SDKs)
  • Wrong minimum or target API level
  • Old custom Gradle templates

This guide also covers

  • unity gradle build failed
  • unity android build failed
  • commandinvokationfailure gradle build failed
  • unity duplicate class gradle

Still not working?

If Unity keeps failing, you're not alone. See every Unity problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

Other Unity errors

All 12 Unity errors and fixes →