Gradle Build Failure when trying to build Android App on a Mac

Hello! I am attempting to build my project and I am getting this error shown below. I do not have any outstanding errors before I build so I do not know where this is coming from:

CommandInvokationFailure: Gradle build failed. 
/Applications/Unity/Hub/Editor/2022.3.47f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2022.3.47f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-7.5.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

Environment Variables: ...

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'Gradle'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10.
 Required by:
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools.build:gradle-settings-api:7.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools:sdk-common:30.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools:repository:30.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools.build:aaptcompiler:7.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools.analytics-library:shared:30.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools.lint:lint-model:30.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > androidx.databinding:databinding-compiler-common:7.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools.build:builder:7.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools.build:builder-model:7.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools.build:gradle-api:7.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools:sdk-common:30.4.2 > com.android.tools:common:30.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools.build:builder:7.4.2 > com.android.tools.analytics-library:tracker:30.4.2
         project : > com.android.application:com.android.application.gradle.plugin:7.4.2 > com.android.tools.build:gradle:7.4.2 > com.android.tools.build:builder:7.4.2 > com.android.tools.build:manifest-merger:30.4.2
      > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10.
         > Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.7.10/kotlin-stdlib-jdk8-1.7.10.pom'.
            > Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.7.10/kotlin-stdlib-jdk8-1.7.10.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5.1/userguide/build_environment.html#gradle_system_properties
                  > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.7.10/kotlin-stdlib-jdk8-1.7.10.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.7.10/kotlin-stdlib-jdk8-1.7.10.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5.1/userguide/build_environment.html#gradle_system_properties
                  > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.apache.httpcomponents:httpmime:4.5.6.

Any help in the right direction would be greatly appreciated!

1 Like

Gradle-y goodness (if that’s even possible) near the end:

How to troubleshoot build failures:

Obviously, if there is actionable data, clues or information within any of the errors, fix those problems. Each error entry may have more information than can fit in the console log so select each error and read the expanded view below it.

If that gives you nothing worthwhile (look to Google! You’re never the first one!), then…

First, make a blank project with a single blank scene and prove that it builds successfully.

If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.

Until you can build a blank project to the target platform, don’t fiddle with anything else.

Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.

Most often things that prevent building are third-party libraries such as Firebase.

Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.

It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.

Android build not building:

Circa July 2022 here have been reports of Unity’s installer failing to install the Android Tools.

Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022 (edited on August 23, 2023 to include Android SDK 33…) (and again for SDK34):

Android Gradle errors and other related stuff: