Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity Gradle build failed to find Build Tools revision 28.0.0

i've been struggling with this issue for days now and i can't seem to find a way to solve it, here is the full error :

CommandInvokationFailure: Gradle build failed. 
C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -classpath "C:\Program Files\Unity2017.2\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleDebug"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'gradleOut'.
> failed to find Build Tools revision 28.0.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
]
stdout[

BUILD FAILED

Total time: 2.877 secs
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, UnityEditor.Android.Progress progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

here is my gradle.build content :

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
    repositories {
        jcenter()
    }

    dependencies {

        classpath 'com.android.tools.build:gradle:2.1.0'
    }
}

allprojects {
   repositories {
      flatDir {
        dirs 'libs'
      }
   }
}

apply plugin: 'com.android.application'

dependencies {
    compile 'com.android.support:multidex:1.0.1'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile(name: 'android.arch.core.runtime-1.1.0', ext:'aar')
    compile(name: 'android.arch.lifecycle.livedata-core-1.1.0', ext:'aar')
    compile(name: 'android.arch.lifecycle.runtime-1.1.0', ext:'aar')
    compile(name: 'android.arch.lifecycle.viewmodel-1.1.0', ext:'aar')
    compile(name: 'cardview-v7-25.3.1', ext:'aar')
    compile(name: 'com.android.support.animated-vector-drawable-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.appcompat-v7-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.asynclayoutinflater-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.cardview-v7-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.coordinatorlayout-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.cursoradapter-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.customtabs-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.customview-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.documentfile-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.drawerlayout-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.interpolator-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.loader-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.localbroadcastmanager-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.percent-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.print-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.recyclerview-v7-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.slidingpanelayout-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.support-compat-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.support-core-ui-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.support-core-utils-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.support-fragment-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.support-media-compat-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.support-v4-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.support-vector-drawable-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.swiperefreshlayout-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.android.support.viewpager-28.0.0-alpha1', ext:'aar')
    compile(name: 'com.github.vungle.vungle-android-sdk-5.3.0', ext:'aar')
    compile(name: 'com.google.ads.mediation.unity-2.1.2.0', ext:'aar')
    compile(name: 'com.google.ads.mediation.vungle-5.3.0.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-ads-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-ads-license-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-ads-lite-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-ads-lite-license-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-base-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-base-license-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-basement-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-basement-license-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-gass-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-gass-license-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-gcm-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-gcm-license-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-iid-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-iid-license-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-location-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-location-license-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-tasks-11.8.0', ext:'aar')
    compile(name: 'com.google.android.gms.play-services-tasks-license-11.8.0', ext:'aar')
    compile(name: 'com.sglib.easymobile.easy-mobile-1.0.2', ext:'aar')
    compile(name: 'com.unity3d.ads.unity-ads-2.1.2', ext:'aar')
    compile(name: 'common', ext:'aar')
    compile(name: 'constraint-layout-1.0.2', ext:'aar')
    compile(name: 'GoogleAIDL', ext:'aar')
    compile(name: 'GooglePlay', ext:'aar')
    compile(name: 'onesignal-unity', ext:'aar')
    compile(name: 'percent-25.3.1', ext:'aar')
    compile(name: 'unity-ads', ext:'aar')
    compile project(':answers')
    compile project(':beta')
    compile project(':crashlytics')
    compile project(':crashlytics-wrapper')
    compile project(':fabric')
    compile project(':fabric-init')
    compile project(':GoogleMobileAdsPlugin')
    compile project(':OneSignalConfig')
}

android {
    compileSdkVersion 21
    buildToolsVersion '28.0.0'

    defaultConfig {
        multiDexEnabled true
        targetSdkVersion 21
        applicationId 'com.chorusworldwide.upjump'
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress '.unity3d', '.ress', '.resource', '.obb'
    }


    buildTypes {
        debug {
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
            jniDebuggable true
        }
        release {
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'

        }
    }

}

for some reason it keeps overwriting its buildToolsVersion to "'28.0.0'" even that i specifically set the build settings to this : enter image description here

I also added my own gradle.build file to Plugin/Android which is the same file but with a different BuildToolsVersion set to 27.0.0, yet, still the build.gradle file located in Temp folder inside the project is resetting itself to "28",

I also added my own gradle.build file to Plugin/Android which is the same file but with a different BuildToolsVersion set to 27.0.0, yet, still the build.gradle file located in Temp folder inside the project is resetting itself to "28", and finally here is some screenshots of my SDK manager :

enter image description here

The partially installed for Android (P) is because of this (i don't have to install them all isn't ?) : enter image description here

the SDK tools : enter image description hereenter image description hereenter image description hereenter image description here

UPDATE: after removing 28.0.0-rc1 from build tools, the build.gradle start building with version 27, but now am getting a new error :

CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -classpath "C:\Program Files\Unity2017.2\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleDebug"
stderr[
C:\Projects\UpJump\Temp\gradleOut\build\intermediates\exploded-aar\com.android.support.appcompat-v7-28.0.0-alpha1\res\values-v28\values-v28.xml:5:5-8:13: AAPT: No resource found that matches the given name (at 'dialogCornerRadius' with value '?android:attr/dialogCornerRadius').

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\DevTools\New_SDK\build-tools\27.0.0\aapt.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
]
like image 313
alaslipknot Avatar asked Mar 16 '18 14:03

alaslipknot


People also ask

How do I find the build tool version?

For the compileSdkVersion you can goto Tools > Android > SDK Manager . This will pull up a window that will allow you to manage your compileSdkVersion and your buildToolsVersion .

Why does gradle Sync Fail?

In some cases when your Gradle files are deleted or corrupted you will not be able to download new Gradle files in android studio. In this case, we have to delete the Gradle files which are present already and then again sync your project to download our Gradle files again.


2 Answers

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'

like image 76
Matt Ostgard Avatar answered Sep 19 '22 15:09

Matt Ostgard


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!

like image 38
alaslipknot Avatar answered Sep 23 '22 15:09

alaslipknot