Hi,
I’m trying to build an apk with Unity version 2020.3.14f1 version on Windows 11 system. I’m getting gradle build failed error even after trying all the fixes required for gradle build failed error. Does it have something to do with Windows 11 version? Below is the error:
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Hub\Editor\2020.3.37f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath “C:\Program Files\Unity\Hub\Editor\2020.3.37f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-6.1.1.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx4096m” “assembleRelease”
stderr[
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:launcher:packageRelease’.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
com.android.ide.common.signing.KeytoolException: Failed to read key AndroidDebugKey from store “C:\Users\sowjanyaG.android\debug.keystore”: Invalid keystore format
Recently (circa July 2022) there have been reports of Unity’s installer failing to install the Android Tools.
If it’s not that, then here’s how to troubleshoot:
First, make a blank project with a single blank scene and prove that it builds successfully.
If it does NOT build, then go fix your Unity installation, or your other tools, such as Android SDK, NDK, JDK, etc.
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 that subsystem.