Gradle build failed

stderr[
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘gradleOut’.

Failed to find Build Tools revision 29.0.0

I have no idea why Unity would choose revision 29.0.0 as Build Tools revision.
I have 28.0.3 installed and worked fine for a long time. How to change this revision?

3 Likes
  1. The reason, why Unity would choose 29.0.0, is that there is a folder named “29.0.0-rc1” in the “Android\Sdk\platforms”. The stupid Unity framework detected the newest revision was 29.0.0-rc1, but it only accepts revision like 2x.x.x. So it wrote revision 29.0.0 to “build.gradle” file.
  2. In the player settings, my selection of the target API level is not “the Highest installed”, but Android 9(28). It seems this selection means nothing to the gradle result.
    By the way, the revision “29.0.0-rc1” was automatically installed by Android Studio. You will never know when your silly Unity will get into this trap.
6 Likes

For everyone coming across this problem, (I don’t know if you found the solution already, luoyu) I circumvented the it by doing the following:

  • Export the Project instead of letting Unity build the apk for me (Select “Export Project” in Build Settings)

  • Opened the exported project in Android Studio

  • Changed the build.gradle file to use the 29.0.0-rc1 build tools

android {
    compileSdkVersion 28
    buildToolsVersion '29.0.0-rc1'
...

and finally

  • Built and pushed the apk to my device via Android Studio.
1 Like

Do you have more option to fix?

by the way I will try this because new project still cannot build.

If you provide more information about your problem, I might be able to help.

What does the console print? What are you trying to do?

https://discussions.unity.com/t/736322
This is it.

I found how to fix

Go to C:\Users\XXXXXXXXXXXXXXX\AppData\Local\Android\sdk\build-tools

Move 29.0.0-rc1 out to anywhere boommm build success.

10 Likes

Best to have android ndk and sdk for unity separate from the one used for Android Studio. I kept running into this problem at least once a year when AndroidStudio updates the SDK to a point where Unity can’t handle it anymore.

You can pick your own folders via Preferences → External tools

2 Likes

I forgot to write the solution:

  1. simply remove the “29.0.0-rc1” folder from your build tools directory.
  2. exported your project, and change the property value of buildToolsVersion to “29.0.0-rc1” or any revision installed. buildToolsVersion is inside the “build.gradle” file.
1 Like

)))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))
)))))) BOOM BOOM )))))))))))))
)))))))))))))))))))))))))))))))))))))))))
)))))))))))))))))))))))))))))))))))))))))

Yes. IT WORKS! That is what I did and success!

NOW…to try to build something with the AR/VR samples without errors…

…TO THE BAT CAVE!!!




4 Likes

thanks

i just renamed the folder and it worked as well

3 Likes

Thanks @StartStart and @luoyu510183 for the tips needed to resolve this. I decided to do it a slightly cleaner way by removing -rc2 build tools using Android Studio:

  • Android Studio > Tools > SDK Manager
  • Choose the SDK Tools tab
  • Unselect the Build Tools and hit Apply; this will remove all of your build tools
  • Tick Show Package Details and then choose the latest version with x.y.z; for me this was 28.0.3
  • Hit Apply; this will download the proper build tools
  • Perform the Unity build; should finish successfully!
7 Likes

This thread was immensely helpful. Thank you all.
For anyone else reading, another option is to uninstall all of the build tools using the SDK Manager and then run Unity. It will complain that there is no SDK and offer to install it. I chose the normal install (not “highest available”) and it finally worked.

Rename to what,
‘29.0.0’ or ???

I update my android studio and sdk, also update unity to 2019.1.0f2. Now it’s giving build gradle error. In my build-tools folder their are 2 file.
One is 28.0.3
Second is 29.0.0-rc2

A problem occurred configuring root project ‘gradleOut’.

Failed to find Build Tools revision 29.0.0

You can just delete the folder “29.0.0-rc2”. It’s not a final released version anyway. Also, Unity 2019.1.0.f2 has embedded the Android SDK. You can just set “Android SDK installed with Unity” in the Preferences window.

1 Like

Thanks for replay. When I delete 29.0.0-rc2 folder. Unity give me panel to update the android studio or select highest available sdk. The reason I update the sdk is because google ads not showing. When I delete 29.0.0-rc2 folder the .apk file is generate successfully but ads not showing. Can you help me with it. It’s almost more than 2 week that I face this problem.

I also post question here with manefist code and AdManger Script. If you can help. : https://answers.unity.com/questions/1627237/admob-ads-not-showing-into-unity-game-please-help.html

After read all post about this, simple, how i use unreal 4 too, i had did the update “sdk base”, “platfoorm tools” and “build tools” by codeworks nvidia , then, here i finded folder 29.0.0-rc2 on build tools folder, dont delete or remove then, i must only update the 3 components

I don’t think it’s a good idea to upgrade your Android SDK to the highest version just for ads issue. On the one hand, google ads not showing might be caused by permission issues or API changes. On the other hand, 29.0.0-rc2 is not an official stable released version. You may build a simple ads app in Android Studio to test which version is okay for ads showing.

1 Like