Hi,
I released an android game yesterday and have started to get crash reports though. I have 3 reports for the same crash that I am unable to reproduce, I also don’t have any of the devices reporting the crash. In all 3 cases the message states that this is a 100% crash preventing the game from booting.
This is the callstack I have:
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:973)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2464)
at android.content.res.Resources.loadDrawable(Resources.java:2371)
at android.content.res.Resources.getDrawable(Resources.java:771)
at android.content.Context.getDrawable(Context.java:402)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3594)
at com.android.internal.policy.impl.PhoneWindowEx.generateLayout(PhoneWindowEx.java:22)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3641)
at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1953)
at com.epicgames.ue4.GameActivity.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:5977)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2258)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5272)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
From the looks of it the crash is occuring here:
if (intentBundle.getString("UseSplashScreen") != null)
{
try {
// try to get the splash theme (can't use R.style.UE4SplashTheme since we don't know the package name until runtime)
int SplashThemeId = getResources().getIdentifier("UE4SplashTheme", "style", getPackageName());
mSplashDialog = new Dialog(this, SplashThemeId);
mSplashDialog.setCancelable(false);
if (ShouldHideUI)
{
View decorView = mSplashDialog.getWindow().getDecorView();
The devices producing the crash as reported are:
LG G3 (g3)
Galaxy S4 (jflte)
Galaxy S6 (zeroflte)
On Android 5.0 & 5.1
It looks like the game is attempting to allocate a ~120mb block of memory to load the splash screen, which doesnt seem correct. Has anyone come across a crash like this before? Because I can’t reproduce it, attempting a fix is likely to just be guesswork, so I’m trying to gather as much information as possible.
One thing I suspect is that the android system is doing a bad job of converting my provided .png image into a .bmp, causing a crash and that perhaps if I instead provide a .bmp image directly this won’t happen.
My other thought is that I could just disable the splash screen and instead implement it myself. But again, this is just guesswork as to where the problem lies.
Thanks
,
Could you please provide me with the full logs that you have available? If you do not have the logs available, could you provide me with a sample project, or your project that this crash is occurring with? Send it to me through a private message on the forums so that no one can obtain your project files.
Thanks!
Hey ,
We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.
Thank you!
I’m having the same problem: put the game in beta, crashes right after launch on a ton of devices with this stack trace:
java.lang.OutOfMemoryError: Failed to allocate a 98724108 byte allocation with 16777216 free bytes and 18MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:747)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:568)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1014)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:3747)
at android.content.res.Resources.loadDrawable(Resources.java:3620)
at android.content.res.Resources.getDrawable(Resources.java:1852)
at android.content.Context.getDrawable(Context.java:408)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3873)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3920)
at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:2102)
at com.epicgames.ue4.GameActivity.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:6289)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
These are not low-end devices at all (2GB RAM). It seems the splash screen is trying to allocate almost 100MBs and hitting some stupid Java-related limits (as usual with Android, everything that’s wrong with it has to do with Java). Our splash screen is a 2208x1242 PNG file, which should amount to only 10MBs as uncompressed RGBA so that’s definitely not right.
We have a Shield Tablet and it works fine there. Oh, how I love Android development.
After tons of googling, it seems that images placed in the res/drawable folder are assumed a 160 dpi and are actually upscaled into larget bitmaps to match the device’s dpi, which matches the amount of RAM being allocated on 480dpi devices (which would use upscale the splash by 3x, causing RAM usage to increase by 9x). Information about this here: android - Why are all my bitmaps upsampled 200%? - Stack Overflow
The solution seems to be moving the splash images from the drawable folder to the drawable-xhdpi folder (which will cause them to be downscaled to lower dpi devices instead). I just uploaded a new version to Play and will report if it works (it runs on my shield tablet as it always did).
It worked, no more crashes due to splash screen! It pays to read the fine print in the Android Project settings more carefully: it says the launch images should be 640x360 (for 160dpi) and higher resolution images should be manually placed in the Build/Android/res/drawable-XXdpi folders