Android packaging problem

I’ve wanted to view my project via VR and went through the process of installing SDK, NDK plugins etc but despite switching around different versions to see if it’ll package properly I still get two errors.

  1. The SDK Not Setup

  2. PackagingResults: Error: Exception org.codehaus.groovy.GroovyBugError [in thread “Daemon worker”]
    PackagingResults: Error: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 [in thread “Daemon worker”]
    UATHelper: Packaging (Android): ERROR: cmd.exe failed with args /c “C:\Users\Micha\Documents\Unreal Projects\MyProject2\Intermediate\Android\arm64\gradle\rungradle.bat” :app:assembleDebug
    PackagingResults: Error: cmd.exe failed with args /c “C:\Users\Micha\Documents\Unreal Projects\MyProject2\Intermediate\Android\arm64\gradle\rungradle.bat” :app:assembleDebug

Been uninstalling and reinstalling things for ages now but the second problem is something I have no clue to fix.

How do I fix this?

1 Like

Same issue, did you solve it?

Hi all,

Try deleting the ‘Intermediate’ folder in your projects directory. (The ‘Saved’ folder can usually be safely deleted too, both will be regenerated)








I still have the error: PackagingResults: Error: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7.

Groovy is killing me. No more groovy feeling here.

I deleted Android Studio and did a complete fresh install of Android Studio 4.2.2. I have all the same settings shown in your Android Studio and UE5 sample screens. Except for:

  1. My java is located at and version confirmed as shown: C:/Program Files/Java/jdk-18.0.1.1
  2. Install location is AUTO.
  3. Package game data inside APK: not checked. (See next item.)
  4. Since I am building an AAB package, all the APP check boxes are checked.

I’m assuming Gradle and Groovy all updated with my fresh install of Android Studio 4.2.2. And I of course rebooted my machine after the fresh install. Full version details below.

So what else should I check? I’ve spent days and days on this. It should not be this hard to build a Google Play AAB bundle using UE5. Has anyone accomplished it?

Thank you with much gratitude to anyone that can help with this. At this point, I’m even willing to pay someone for the help to save the last bits of my brain, my sanity and my hair.

Version settings details:
Did a fresh install of Android Studio 4.2.2. In SDK platforms:
Android API 32; sdk platform 32 and sources for android 32 installed.
Adroid 11.0; the same.
In SDK tools installed: 30.0.3, 29.0.2, 28.0.3
NDK: 21.4.7075529
Android SDK Command Line Tools: 4.0
Cmake: 3.10.2.4988404
Android Emulator: 31.2.10
Android SDK Platform Tools: 33.0.2.
All of these were default settings. I am assuming Gradle and Groovy are correctly loaded with the fresh Android Studio Install.

In UE5 project settings, confirmed SDK/NDK directories and locations in Android SDK settings. Android NDK: 21.4.7075529. JDK 18.0.1.1. NDK API Level: android-23.
Minimum SDK Version: 23.
Target SDK Version: 32
APP Bundles all checked.
All my keystore information is also there.

The other related errors are as follows:
PackagingResults: Error: Exception org.codehaus.groovy.GroovyBugError [in thread “Daemon worker”]
PackagingResults: Error: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 [in thread “Daemon worker”]
PackagingResults: Error: cmd.exe failed with args /c “C:\Users\rando\Documents\Unreal Projects\AR Ah\Intermediate\Android\gradle\rungradle.bat” :app:bundleRelease

1 Like

Finally! I got a “Build Successful.” Though I have yet to load it onto my phone to try it out. Nor try to upload it to Google Play. We shall see.

After a week of messing with my Java SDK/NDK/JRE and Android Studio, in frustration I deleted everything to start fresh. Two weeks ago I was able to get a working development build for UE5 using this video: Android / VR / AR Setup in Unreal Engine 5 / 4.27 by Nils Gallist.

Now once again I was able to package a working development version. Yay! No AAB. Not distribution. No keystore information. No google play support. This also removed my Gradle/Groovy errors. This put me back where I was 2 weeks ago. Ugh.

So, I started adding packaging features. And no errors until I added “Distribution” and keystore information. I then had an invalid keystore error that was the root of my problem!

To fix it, I finally ended up building a new keystore using the command line keytool (run as Administrator) using the Java keytool located in the Platforms -Android SDK Java directory setting. In my case: C:/Program Files/Android/Android Studio/jre. This is NOT the usual Java directory. Instead, it is the Android Studio java. (There are several good posts around on the invalid keystore files.)

All this allowed my to have a successful build. Finally!!! Now to see if Google Play accepts it.

My thanks to the many people who generously offered their time and expertise. Every little bit lead to my success. I hope this helps anyone else having problems doing an UE5 Android AAB build for distribution.

3 Likes

Version 29 is old file. need version 32. after June 2023.