Android build crashes repeatedly upon launch or level loading before working

I am developing a mobile game with UE4 and am testing it primarily with my Android Moto G5 Plus running a rooted Android 7.0 with a build of NPN25.137-35. I can launch just fine, but when I open the app it crashes. When I open it again, it crashes. I keep opening it, and eventually it always works, and the app runs as it should, except when new levels are loaded it also crashes, but only sometimes. If I just keep trying to open the game or load the level it always eventually works.

When I launch the game on my Nexus 9 (Android 7.11, Build N4F26Q, also rooted) it only crashes the first time the computer launches it, but gives the on screen error message “Message Failed to read file. Null Stream Line: 1 Ch: 0” then I press ok and back on the computer screen it says that it completed the launch successfully. I wrote in the attached launch logs when that happened. However, when I try to reopen the app on my Nexus 9 it always works, along with the level loading always working.

I don’t know what to make of this, and although it isn’t interfering with development much, it is certainly annoying. Sorry if I gave too much build information and whatnot about my devices that you didn’t need, I wanted to be safe. I am also using UE4 version 4.17.2 and am developing on a Windows 10 PC, although you probably could have figured out the PC part just from how all my devices are rooted. The logs are attached.

Thank you for your time.

A logcat from the device would be best to track down the problem; this is the package and launch (PC side) logs which has the crash cut off on the Nexus9 log (---- beginning of crash) and doesn’t have any logcat for the Moto G5. A raw logcat should have the crash information which should help track it down.

Thanks, how do I get a logcat?

You can run “adb logcat -d >log.txt” after the crash to dump logcat to log.txt.

Ok, I got it.

Ok, I looked at the callstack and the issue you ran into is a rare case fixed in 4.18. If you are working from source you can edit Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformFile.cpp line 158 and change:



            this->PollCompletion() && Memory)

This will fix the problem.

Thanks! I will try this when I get home.

I don’t think I am working “from source.” I installed the Unreal Engine from the launcher. I found the file you were speaking of and the code you were pointing to, but I could not edit it, as it was a read only file. Should I try to install the Unreal Engine from source just to get this to work, or should I try the 4.18 preview?

It is fixed in the 4.18 released today so easiest to try it.

Well… now using 4.18 I cannot launch it because the Unreal Engine crashes when I try to launch it to my phone. Not when I launch to my computer, just my phone. My crash log is attached. (It was called TopDown.log, but I changed it to a txt so I could upload it, I hope that is the right file.)

EDIT: The editor also crashed just the same when trying to launch to my nexus.

Try packaging for ETC1 and see if that works.

I tried ETC1, nothing crashed, but it didn’t build successfully. ETC2 same and no luck. I tried ETC1 with Ant instead of Gradle and it said it built sucessfully, but the app on my phone is stuck on splash screen. At the end of that build my computer said that Unreal Engine had stopped working, but because I still saw animations playing, I just closed that window and it finished the build, though the command window it had open elseware closed when I got rid of that notification.

I used a command (link below) I found to accept the licences I found in the error codes blocking the build from getting past “rungradle.bat,” but then ran into the same problem I got into when I tried to make it work with ant, where it says the program stopped working. I double checked after accepting licences, and the entire Unreal Engine does still crash when I just hit the launch button to my phone.

It seems that the “Unreal Engine” it is referring to when it says it stopped working is a command window that pops up when launching. When I hit the close program button, that is what closes.

I went through all the work of installing 4.17 ue4 from GitHub and changed that one line of code and it WORKS without crashing. Finally. Thank you.

There is still the issue of how I cannot use 4.18 because it crashes upon launching for Android. Is this a problem specific to me? Has anyone else been able to replicate it? Should I ask for a bug fix?