Android builds do not work anymore

When I first tried to build the AR app with ARCORE the building worked fine. I then tried the arcore-unreal-sdk Augmented Image sample project and I got a build error that I now get every time I try to build any kind of android app (see below). I played around with installing different versions of the ndk, sdk, etc. Then I deleted all android and unreal content and installed it again, but it didn’t change anything.
Any idea how I could solve the issue?

Thanks!

This is part of the error log that I get with the action rpg example:

[130/133] ActionRPG-arm64-es2.so
LogPlayLevel: C:/NVPACK/android-ndk-r14b/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android/4.9.x/…/…/…/…/aarch64-linux-android/bin\ld: cannot open output file C:/Unreal Projects/ActionRPG/Binaries/Android/ActionRPG-arm64-es2.so: Permission denied
LogPlayLevel: Error: clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
LogPlayLevel: [131/133] ActionRPG-x64-es2.so
LogPlayLevel: Error: C:/NVPACK/android-ndk-r14b/toolchains/x86_64-4.9/prebuilt/windows-x86_64/lib/gcc/x86_64-linux-android/4.9.x/…/…/…/…/x86_64-linux-android/bin\ld: fatal error: C:/Users/micha/OneDrive/Documents/Unreal Projects/ActionRPG/Binaries/Android/ActionRPG-x64-es2.so: open: Permission denied
LogPlayLevel: Error: clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
LogPlayLevel: [132/133] ActionRPG-armv7-es2.so

This is what I get with the handheld AR example:

LogPlayLevel: Creating rungradle.bat to work around commandline length limit (using unused drive letter Z:)
LogPlayLevel: Making .apk with Gradle…
LogPlayLevel: To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: The Gradle Daemon - Gradle User Manual.
LogPlayLevel: Daemon will be stopped at the end of the build stopping after processing
LogPlayLevel: FAILURE: Build failed with an exception.
LogPlayLevel: * What went wrong:
LogPlayLevel: com/jcraft/jsch/JSchException
LogPlayLevel: > com.jcraft.jsch.JSchException
LogPlayLevel: * Try:
LogPlayLevel: 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.
LogPlayLevel: * Get more help at https://help.gradle.org
LogPlayLevel: BUILD FAILED in 2s
LogPlayLevel: Error: ERROR: cmd.exe failed with args /c “C:\Unreal Projects\ARProjectD\Intermediate\Android\APK\gradle\rungradle.bat” :app:assembleDebug
LogPlayLevel: Took 4,3866909s to run UnrealBuildTool.exe, ExitCode=5
LogPlayLevel: UnrealBuildTool failed. See log for more details. (C:\Users\micha\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.24\UBT-ARProjectD-Android-Development.txt)
LogPlayLevel: AutomationTool exiting with ExitCode=5 (5)
LogPlayLevel: Completed Launch On Stage: Build Task, Time: 4.255555
LogPlayLevel: BUILD FAILED
PackagingResults: Error: Launch failed! Unknown Error

2 Likes

Hi ,

The first thing I would try will be to start a total new project from the project template(first person template for example) and build over to android, if it works then the errors got to do with your existing projects. Then i will delete all the folders in intermediate folder except config folder, then delete any other folders in your project directory that is not content,intermediate and config folder. Then start the project again and launch it to device, it should work.

If a total new project from project template also do not work, then it will be problems with environment setup most probably with Nvdia codework version(SDK,NDK settings), visual studio version etc. It will be best to use the version that comes with the UE4 version that you are using, although sometimes there is a need to even install android studio and update certain SDK for it to work sometimes, lots of trial and errors needed here.

Oh for AR/Google VR apps, the last version that I know that works without problem was UE4.20.3 .

Hope it helps .

Bump… I have been having the same problem. I cannot get the action rpg to compile to android. Same error and everything. Did you ever find a solution?

Bump. Still having the same issue building.

Ever try it with the 4.26 version? I am wondering if I should give this a shot. It’s been a year you’d think they could fix it by now.

bumpitty bump bump

Same issue, happens in 4.25, 4.26, & 5.0EA, tried every solution imaginable, have completely uninstalled and reinstalled android studio, tried different NDK/JRE/AndroidSDK versions, still not working.

Occurs when packaging for my Google Pixel 4a 5G and Oculus Quest 2.

My only theory is that it’s because I’m not using a non-administrator account on a Windows 10 PC.

If anybody has found a solution please let me know.

EDIT:
I found a solution. look to the post below for more info.

1 Like

Update:

After struggling non-stop with this issue for over 6 months, having completely given up on android development, and having the issue persist no matter what I did, I finally figured out the issue.

Now, this may not work for you, but it definitely worked for me and it is rather simple:
Disable your antivirus.

I was using Windows Defender, the stock antivirus in Win10, although even if you are using a different antivirus I would greatly recommend trying to build with it disabled.

If that does not work, some other solutions I’ve seen include:

SOLUTION 1
Deleting the Intermediate, Saved, and DerivedDataCache folders from your project, then delete the .gradle folder in your user folder (looks something like C:/Users/{YOURUSERNAME}/.gradle where {YOURUSERNAME} is the account name you use for signing in to your PC.)
Then Rebuild.

SOLUTION 2
Opening Android Studio and on the welcome menu, go down to configure, click SDK Manager, and select everything above Android 4.3 (Jellybean) API level 18, Then click Apply, and then OK once the install is finished.
Then Rebuild.

SOLUTION 3
Generate a new key with JDK using the following tutorial:
Error cmd.exe failed with args - YouTube
Then Rebuild.

And finally,
If all else fails,
Try reinstalling all of the android stuff. Sometimes something might just goof itself up in the installation process and this if you do it in the exact same order as This Documentation Tutorial, it should hopefully work.

Cheers!

8 Likes

Still having problems … Any help ue 4.26

I also have faced with a lot of troubles while trying to make things work. So here is a small list of my advices:

  1. Reinstall Android studio as it suggested here. I don’t sure is it necessary, but this may clear out results of all your failed attempts.
  2. Go to SDK manager and install additional Android Studio 10.0+ (R and Q) for API level 29 and 30. Uninstall SDK for API level 33.
  3. Go to C:\Users\<UserName>\AppData\Local\Android\Sdk\ndk\21.4.7075529\platforms. Firstly make sure that you have only this NDK version (21.4.7075529). Then check in the folder above for the android-29 folder.
  4. For launching on android always run the UE in administrator mode.
  5. In your projects settings manually set up location of JAVA to the one installed with Android Studio (usually it is C:\Program Files\Android\Android Studio\jre).
  6. In UE projects settings find Android SDK section and set these settings: SDK API level to 29 and NDK API level to android-29.
  7. After that try to launch the game on your device. If you got the Failed to open descriptor error, then create a build and install your game on the phone via bat-script.
1 Like

Who still facing this problem :

God bless you man. I was trying for hours