Android build error can't find keystore fixed in update but now has issue with building

I’m getting an error when packaging my build for android. attached is there error. any help would be lovely

FAILURE: Build failed with an exception.

* Where:
Build file 'E:\work stuff\gremm studios stuff\game\GretasPawUnity\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':launcher'.
> Failed to apply plugin 'com.android.internal.application'.
   > org.gradle.api.InvalidUserDataException: Failed to get default debug keystore location.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s



CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Unity\Hub\Editor\2022.3.38f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2022.3.38f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.5.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

Environment Variables:
PROCESSOR_ARCHITECTURE = AMD64
AMPLITUDE_API_KEY_YELLOWBUCKET_DEV = 48835b4d1f5e342aefe5f016324d296a
ANDROID_NDK_ROOT = C:\Program Files\Unity\Hub\Editor\2022.3.38f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK
DriverData = C:\Windows\System32\Drivers\DriverData
USERDOMAIN = KYLES-BIGPC
CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files
COMPUTERNAME = KYLES-BIGPC
DEBUG_ENV_VAR = UnityHub
LOGONSERVER = \\KYLES-BIGPC
AMPLITUDE_TOKEN_GREENBUCKET_PROD = ZpUcbAdZXJYzNSoHsAWtL_s_JppwWid9
NDK_ROOT = C:\Users\Kyle\AppData\Local\Android\Sdk\ndk\25.1.8937393
PUBLIC = C:\Users\Public
ProgramData = C:\ProgramData
SESSIONNAME = Console
AMPLITUDE_TOKEN_YELLOWBUCKET_PROD = UYDQtPOw83dIfVy3SrW5oMyo7ru4PRkV
RlsSvcPort = 22112
ANDROID_HOME = C:\Users\Kyle\AppData\Local\Android\Sdk
APPDATA = C:\Users\Kyle\AppData\Roaming
SystemRoot = C:\WINDOWS
windir = C:\WINDOWS
AMPLITUDE_API_KEY_REDBUCKET_DEV = 46b8b46515e7632fc42a504b72e05fd0
ProgramFiles(x86) = C:\Program Files (x86)
ProgramW6432 = C:\Program Files
EFC_11700 = 1
OS = Windows_NT
PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
HOMEPATH = \Users\Kyle
AMPLITUDE_TOKEN_REDBUCKET_DEV = U4PSN7S7PuYVRODivvdcFwbu8R6IHGqa
ACSetupSvcPort = 23210
CHROME_CRASHPAD_PIPE_NAME = \\.\pipe\crashpad_31240_SEVOPUWFTVYRCRBV
PROCESSOR_LEVEL = 6
NDKROOT = C:\Users\Kyle\AppData\Local\Android\Sdk\ndk\25.1.8937393
CommonProgramFiles = C:\Program Files\Common Files
JAVA_HOME = C:\Program Files\Unity\Hub\Editor\2022.3.38f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
USERDOMAIN_ROAMINGPROFILE = KYLES-BIGPC
TEMP = C:\Users\Kyle\AppData\Local\Temp
CommonProgramW6432 = C:\Program Files\Common Files
AMPLITUDE_TOKEN_YELLOWBUCKET_DEV = wKi8foVigDditGFvmZewRFWsEbX9Y0YO
AMPLITUDE_API_KEY_GREENBUCKET_DEV = 3ded2a762163603391a425f688f990c8
AMPLITUDE_API_KEY_REDBUCKET_PROD = ca12bb461ea96f9bdf5df4ded7d52994
HOMEDRIVE = C:
AMPLITUDE_API_KEY_STAGING = 83ee04fccc67e4fcc7dd527c4c6f1e21
USERNAME = Kyle
OneDrive = C:\Users\Kyle\OneDrive
AMPLITUDE_API_KEY_YELLOWBUCKET_PROD = e03a9bbe92dc38a88cdb068d24c65b46
PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
AMPLITUDE_TOKEN_REDBUCKET_PROD = jTIgKs5KTZOjiqEEVdZFbgo_VRhABduL
NUMBER_OF_PROCESSORS = 6
GTK_BASEPATH = C:\Program Files (x86)\GtkSharp\2.12\
AMPLITUDE_TOKEN_GREENBUCKET_DEV = 84H2gMm_FJzhr3mBaX1lM1JVukmCM7d9
AMPLITUDE_DEPLOYMENT_KEY_RED_BUCKET_DEV = client-wbjHYrmeSR87GmWOE7LDpf7sUySOIKHm
PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
AMPLITUDE_API_KEY_GREENBUCKET_PROD = c86fea37a9e1d3f0878b96e15b111c7c
ComSpec = C:\WINDOWS\system32\cmd.exe
EnableLog = WARNING
ORIGINAL_XDG_CURRENT_DESKTOP = undefined
ANDROID_SDK_HOME = C:\Users\Kyle\AppData\Local\Android\Sdk
PROCESSOR_REVISION = 9e0a
AMPLITUDE_DEPLOYMENT_KEY_RED_BUCKET_PROD = client-zH8Y7OK1i331EKuG77C6UxN8ygcM6LzS
TMP = C:\Users\Kyle\AppData\Local\Temp
SystemDrive = C:
AMPLITUDE_API_KEY = 28f3cae0b33b8b3702120c9ed1a935aa
ACSvcPort = 17532
OneDriveConsumer = C:\Users\Kyle\OneDrive
SENTRY_ACCESS_TOKEN = 3df78d9e53f8456aa90fbae044ce1a6261421ab1d0014674bc2e933477289017
ALLUSERSPROFILE = C:\ProgramData
Path = C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\java8path;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\Kyle\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\Perforce\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA app\NvDLISR;C:\Users\Kyle\AppData\Local\Microsoft\WindowsApps;C:\Users\Kyle\AppData\Local\Android\Sdk\platform-tools;C:\Users\Kyle\AppData\Local\Android\Sdk\tools;C:\Users\Kyle\.dotnet\tools;
ProgramFiles = C:\Program Files
LOCALAPPDATA = C:\Users\Kyle\AppData\Local
USERPROFILE = C:\Users\Kyle
WOOTRIC_CLIENT_TOKEN = NPS-aa8be4c3


stderr[

FAILURE: Build failed with an exception.

* Where:
Build file 'E:\work stuff\gremm studios stuff\game\GretasPawUnity\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':launcher'.
> Failed to apply plugin 'com.android.internal.application'.
   > org.gradle.api.InvalidUserDataException: Failed to get default debug keystore location.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
]
stdout[

]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <2fb5bcd8e6024287bf092a8fc109e39b>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <2fb5bcd8e6024287bf092a8fc109e39b>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <2fb5bcd8e6024287bf092a8fc109e39b>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <2fb5bcd8e6024287bf092a8fc109e39b>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <2fb5bcd8e6024287bf092a8fc109e39b>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <2fb5bcd8e6024287bf092a8fc109e39b>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <2fb5bcd8e6024287bf092a8fc109e39b>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <2fb5bcd8e6024287bf092a8fc109e39b>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Is your keystore missing?
Did you add a keystore to your Publishing Settings? If not, you can create one under:
Edit → Project Settings → Player → Publishing Settings
look here

Enable “Custom Keystore” and use the Keystore Manager to create a key and place it inside your project. Keep the passwords somewhere save. You have to type it in everytime, if you restarted Unity, before you start a build.

Yes i did. And i even readded it.

Error mentions debug keystore. Try removing “C:\Users\username\.android\debug.keystore”, Unity would recreate it on next launch.

Tried that. It did not recreat it at all. Still gave the same error. And then when i restored thr files it said same thing.

Did you restart Unity after deleting keystore?
If that doesn’t help - open android studio and try to build. That should create debug.keystore as well

Yes i did. And how would i do that on android studio?

I updated to the latest 2024 build and same issue.

so i figured out how to build and that didn’t work but when i update android studio it fixed that error. but when it build it was an errored project, nothing worked. so i tried to use that android
studio sdk and stuff and it give a message saying cant read and outdate and when i try to update it is just stuck in a loop. what should i do? i really need help!


Screenshot 2024-09-23 135320

How does your External Tools window look?

Edit > Preferences > External Tools > Android

here is what it looks like. this is with the android studio files selected instead of unity. which give the error message attached above
Screenshot 2024-09-24 132335

and this is the default wich builds but the app crashes idmeatly. which is something the older versions of unity did not do. and there has been no changes except the update of unity
Screenshot 2024-09-24 132046

And I tried exporting it to Android studio and building but it still is using the unity scripting. So it’s looking for files that do not exist in that situation. And if I try to use third party files through the preferences instead of the unity ones, it will not build no matter what, but when I build with unity like I said that just crashes, the application does not work even though there’s been no changes to it other than the update to unity.

So I tried pulling the old backup from the server from the last time. It built successfully using the old version of unity with that. It does the exact same thing. The new version of unity does the game. Once it’s built builds fine with the unity’s default settings. But the game launches and then you click one thing and it and it crashes, and then if you try to use the Android studio. SDK it says that it can’t see it because it needs to be updated, but won’t update it because it says the file is not rightable, just like the other version of unity does. Is there anything else we can try?

I have seen other post that people are having the same issue. Please i need help what can be done to fix this?! The deadline for the play store is november 2nd. And this needs to be resolved. @IGuscin

One of the options - completely remove Unity, remove debug.keystore (“C:\Users\username.android\debug.keystore”) and install latest Unity version. Make sure, that all the External Tools settings are set to default (to use tools delivered with Unity). Try to make a build. If you face issues - post new error log you’re seeing.
Also, you can try creating a custom keystore (your initial error was talking about debug.keystore, so maybe would succeed using custom one)

So we’ve already.
Done that the issue with the keystore has been fixed. The issue we’re having now and the later messages. Is that when we go to build in unity? The application crashes right after it launches. Or if we try to use the SDK from Android studio, unity doesn’t recognize. There’s a version on there and can’t update it because it just goes in a loop or it says that the file is not readable.

If build succeeds using Unity default setup - good. For the crash - share exact crash log

It is crashing on the testing phones that the apk is installed on. It started on this most reacent update on any devices that are running android 14. Which is nesscarry for playstore adherence for there policy old builds on older phones work fine. And the older app on the app store works. Its just the new stuff that were having issue with.

Share the crash log.
The only thing I can think of - broadcast receiver crash on Android 14, so you can try searching that direction:
Remove all the Gradle templates from your project (make a backup just in case)
Recreate needed templates
Resolve dependencies using External Dependency Manager
Build and run

If these steps didn’t help - probably that crash is caused by one of the plugins you’re using. You could try updating all of these to the latest versions (a lot of the plugins were already updated to address that issue) or try removing these one by one until crash is gone

How do i get the crash log off the phone?