Issue with non-distribution builds with C++ projects for Android

Hello,

I’ve recently run into an issue when compiling my VR projects for Android that are not marked for distribution. This issue only occurs when it is a C++ project, but if it’s blueprint only, it does not occur.

When I compile, I receive the following error output in the log.

UATHelper: Packaging (Android (ASTC)): FAILURE: Build failed with an exception.
UATHelper: Packaging (Android (ASTC)): * What went wrong:
UATHelper: Packaging (Android (ASTC)): A problem was found with the configuration of task ':app:packageDebug' (type 'PackageApplication').
UATHelper: Packaging (Android (ASTC)):   - In plugin 'com.android.internal.version-check' type 'com.android.build.gradle.tasks.PackageApplication' property 'signingConfigData.signingConfigData.storeFile' specifies file 'Z:\app\.android\debug.keystore' which doesn't exist.
UATHelper: Packaging (Android (ASTC)):     
UATHelper: Packaging (Android (ASTC)):     Reason: An input file was expected to be present but it doesn't exist.
UATHelper: Packaging (Android (ASTC)): Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
UATHelper: Packaging (Android (ASTC)):     
UATHelper: Packaging (Android (ASTC)):     Possible solutions:
UATHelper: Packaging (Android (ASTC)):       1. Make sure the file exists before the task is called.
UATHelper: Packaging (Android (ASTC)):       2. Make sure that the task which produces the file is declared as an input.

I should note that the path that my Android Studio SDK is setup for is down D:\Android\SDK
Android Studio is installed on my C drive, under the standard installation location.
It is Android Studio 2022.2.1 patch 2 as per the documentation.

I’ve run the setup batch file multiple times with no changes.

These are my environment variables currently set on my machine.
ANDROID_STUDIO_PATH - C:\Program Files\Android\Android Studio
JAVA_HOME - C:\Program Files\Android\Android Studio\jbr
NDK_ROOT & NDKROOT - D:\Android\SDK\ndk\25.1.8937393

I can circumvent the issue by doing a build that will fail, then manually copying the .android folder with the debug.keystore to both \Intermediate\Android\arm64\gradle\ and \Intermediate\Android\arm64\gradle\app\

If you only put it in the \app folder, it will show another error about it missing from the gradle folder up one level.

I have tried reinstalling Android Studio, the SDK/NDK/JDKs and Unreal Engine itself. I’ve also run from the engine source code with the same errors.