Unity Gradle build failed to find Build Tools revision 28.0.0

AWrightIV's answer got me most of the way there. But the solution for me was less complicated. I generated a mainTemplate.gradle file that unity creates when you turn on "use custom gradle file" in the player settings and changed the buildToolsVersion line.

Original line in Assets/Plugins/Android/mainTemplate.gradle:

buildToolsVersion '**BUILDTOOLS**'

New:

buildToolsVersion '27'


Solved it!

my main issue was here :

enter image description here

see all these 28.0.0-alpha files, the problem start occurring because of these, i am 100% sure of it because when i rolled back (thankfully am using version control) one of the main differences was that these libraries weren't there, i deleted them, but they kept coming back due to the "Play Service Resolver", so i figured it has nothing to do with whatever version i have installed in my Android SDK and it was 100% related to one of the plugins.

I created a new project, imported GoogleAdsMediation for Unity (that's the most important plugin) and did the "Resolving" thing, and there was no "28" files at all, so it wasn't google plugin, i kept doing with this with all the plugins we have. import -> delete all libraries -> force resolve. Until i found the culpable one, it was OneSignal, their dependencies configuration (or something) forced the resolver to import these "28.0.0-alpha" libraries, i deleted that version of OneSignal, imported an older one (from an older version of our project) and Boom! problem solved :)

I hope this helps.

cheers!


The answer in the similar issue mentioned by @SawThinkarNayHtoo will get you most of the way. Here's that link again: Importing Vufoira Scene into native android app

The gist of it is you want to export your Unity project while targeting Android. There are great tutorials elsewhere about how to do this, but here's the link from the answer above: Export Unity Project to Android Studio

After following the steps above, I needed one more step:

  1. In Android Studio, open your exported project and go to Edit > Find > Find in Path...
  2. Search for "buildToolsVersion" without the quotes.
  3. Replace all instances of versions "buildToolsVersion '28" with "buildToolsVersion '27".

If necessary, you can also edit the files without exporting. Search your project directory in the file system for "buildToolsVersion". You should find build.gradle files. Edit those as above.