Android Packaging - Java / Gradle error?

Hello! Having an issue packaging for Android (Multi:), I followed a few folks fixes for this, though it did not fix my end. I’m not sure if I need a specific version of Android for UE4.26 either. I tried troubleshooting nearly every checkmark in the Project Settings relating to the packaging process, alas.

Main error line that sticks out to me is “Execution failed for task ‘:app:compileDebugJavaWithJavac’.”

To get to this point, I installed from NVIDIA CodeWorks for Android 1R8, then Android Developers android-ndk-r21d-windows-x86_64

Android NDK version - r21d

JDK version - 1.8.0_77

Things I have tried -

  • changing store version offsets
  • changing/switching build supports
  • checking advanced build
  • deleting gradle cache in local disk / users /user folder
  • imported java template file from someone who fixed their same error issue under Build/Android/src/com/epicgames/ue4
  • Swapped Gradle version folders from 4.4.1 to 6.1.1 in C:/NVPACK/

Critical part of UBT Android Development Log:


UEDeployAndroid.FilterStdOutErr: 1 error
UEDeployAndroid.FilterStdOutErr: 91 warnings
UEDeployAndroid.FilterStdOutErr: > Task :permission_library:bundleLibRuntimeToJarDebug
UEDeployAndroid.FilterStdOutErr:
UEDeployAndroid.FilterStdOutErr: 52 actionable tasks: 52 executed
UEDeployAndroid.FilterStdOutErr: FAILURE: Build failed with an exception.
UEDeployAndroid.FilterStdOutErr:
UEDeployAndroid.FilterStdOutErr: * What went wrong:
UEDeployAndroid.FilterStdOutErr: Execution failed for task ‘:app:compileDebugJavaWithJavac’.
UEDeployAndroid.FilterStdOutErr: > Compilation failed; see the compiler error output for details.
UEDeployAndroid.FilterStdOutErr:
UEDeployAndroid.FilterStdOutErr: * Try:
UEDeployAndroid.FilterStdOutErr: 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.
UEDeployAndroid.FilterStdOutErr:
UEDeployAndroid.FilterStdOutErr: * Get more help at https://help.gradle.org
UEDeployAndroid.FilterStdOutErr:
UEDeployAndroid.FilterStdOutErr: BUILD FAILED in 16s
UnrealBuildTool.Main: ERROR: cmd.exe failed with args /c “C:\Users\hillc\Documents\PerforceWorkspaceRoot\MyFirstFps\Intermediate\Android\arm64\gradle\rungradle.bat” :app:assembleDebug
UnrealBuildTool.Main: BuildException: cmd.exe failed with args /c “C:\Users\hillc\Documents\PerforceWorkspaceRoot\MyFirstFps\Intermediate\Android\arm64\gradle\rungradle.bat” :app:assembleDebug

I have figured out what to do to fix this, at least on my end here.

I did not have the Android Developer - Android Studio application installed, and this helps keep certain things up to date.

Once I installed Android Studio, I realized it’s easy to keep the Android Studio IDE and Android SDK tools up to date with automatic updates and you can access the Android SDK Manager. Android Studio gave me the proper SDK build-tools or platform tools needed to begin the packaging process. Now UE4 packages the project to the Android folder.

I also learned you must keep the Android Studio closed before you start the install after linking an Android device, as it must be the only one connected during the install.

1 Like