Blog

How to solve Unity Android Gradle Build issues

Unity is a powerful engine that makes cross-platform game development easier than ever. But if you’ve worked with Android builds for long enough, you’ll know that things don’t always go smoothly.

Game Studios in Australia

Jacques Leemans · Android, Gradle, Maven, Unity · September 16, 2024

Unity is a powerful engine that makes cross-platform game development easier than ever. But if you’ve worked with Android builds for long enough, you’ll know that things don’t always go smoothly.

Gradle errors, mismatched Android plugins, broken Maven dependencies, and mysterious build failures can appear out of nowhere, often right when you need that release build the most.

This post is a living guide to fixing Unity Android build issues.

I’ll continuously update it with solutions, workarounds, and troubleshooting tips that I’ve personally encountered (and solved) while building Unity projects for Android.

Failed to install the following SDK components

When you upgrade native plugins or upgrade Android SDK, you might get an Android Gradle Build error like:

Could not determine the dependencies of task ':unityLibrary:GoogleAdProvider.androidlib:generateReleaseRFile'.
> Failed to install the following SDK components:
      build-tools;30.0.3 Android SDK Build-Tools 30.0.3
  The SDK directory is not writable (C:\Program Files\Unity\Hub\Editor\2022.3.21f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK)

The issue here is the build-tools can’t be installed in the Unity Editor Directory.

What worked for us, was to install Build-tools 30.0.3 in the Android SDK Manager using Android Studio

android-sdk-build-tools-30.0.3

Then copy the build tools from:

%LOCALAPPDATA%\Android\Sdk\build-tools\30.0.3 — paste that into File Explorer's address bar and it'll take you straight to your own folder, no need to swap in your username

To:

C:\Program Files\Unity\Hub\Editor\2022.3.21f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\30.0.3

Need Help Fixing Android Issues?

Contact Us