Weird crash bug on Android 5.0 Lollipop, only when installed from Google Play Store

Hi,

I found a weird crash bug, help me find out the cause of it!

On the following Java code called by Unity’s AndroidJavaObject, somehow it crashes with SIGSEGV on Android 5.0 when just a NullPointerException is thrown. “a.toString” causes NullPointerException and the exception is always catched and NEVER crashes on Android 4.4 and older.

// Called from Unity C# like: (new AndroidJavaObject("jp.co.cyberz.TestUnityException")).Call("test");
public void test(){
  try {
    String a = null;
    a.toString(); // CRASH!!
  } catch (Exception e) {
  }
}

(Uploaded the project at Dropbox)

logcat:

Crashes on the following conditions.

  • Installed from the Google Play Store(To check, uploaded at the store )

  • Unity 4.2.2 and older versions

  • Running on Android 5.0, not on Android 4.4 w/ ART runtime

I know I can fix it by upgrading Unity version, but I cannot. I provide SDKs and must support the older versions.

Do you have any idea about the cause, or does anybody encounter it?
I cannot believe it crashes only when installed from the Google Play store…

1 Like

We are having the exact same problem. I have a NullPointerException thrown from Java code within Unity 4.2 games, and they all crash, only when downloaded from the Google Play Store on Android 5.0. This did not happen on Android 4.*, and it doesn’t happen when the apk is sideloaded via adb install, and it doesn’t happen on Unity 4.3.

In our case, the crashing code is:

JSONObject myObject;
String s = null
try {
myObject = new JSONObject(s); // <— crash here
}
catch (Exception e) {
}

We have about 30+ games with this problem.

I also posted a bug against Android here (many many thanks to Sahara for the sample):
https://code.google.com/p/android/issues/detail?id=79288&thanks=79288&ts=1415920385

I just updated my phone to Android 5 and it is crashing during start with:

11-18 18:56:15.624 5289-5316/? E/qdutils﹕ FBIOGET_FSCREENINFO failed
11-18 18:56:16.013 5289-5316/? A/libc﹕ heap corruption detected by dlfree
11-18 18:56:16.013 5289-5316/? A/libc﹕ Fatal signal 6 (SIGABRT), code -6 in tid 5316 (UnityMain)

Hello guys,

I am having the same problem only on Android 5 L,

Device model : LGE Nexus 5
Device fingerprint: google/hammerhead/hammerhead:5.0/LRX21O/1570415:user/release-keys

Caused by: java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000018
Build fingerprint: ‘google/hammerhead/hammerhead:5.0/LRX21O/1570415:user/release-keys’
Revision: ‘11’

Same here. In Nexus 4 on Android 5.0.0. Did you guys find a solution to this?? I’m using Unity 4.6.0f1.

Did you guys try with the latest version?

Patch 4.6.1p2 - Released: 19 December 2014

1 Like

Did 4.6.1p2 fix this for any of you guys?

I’ll give update on that today itself. Btw, 4.6.0f1 has this bug too.

I’m also getting random SIGSEGV errors. I’m using Unity 4.6.1p2. Process is just dying with no apparent reason and without any logs or stacktraces.

The exact unity build that resolves this issues is 4.3.1 . Find it here : http://unity3d.com/unity/download/archive .

We used this build to publish to play store and solve those crashes. ( Just a workaround to avoid those bad 1 star ratings :frowning: )

What you are seeing is discussed here. Experiencing the same !! - http://forum.unity3d.com/threads/android-black-screen.213331/page-2

Sadly 4.3.1 doesn’t include new GUI so it’s not a deal for me.

1 Like

Exactly !! Using the new unity ui and stuck with this bug :frowning:

Same here. New ui. :face_with_spiral_eyes: :frowning: Can’t go back.

1 Like

4.6.1.p2 worked! Issue solved in Android 5! :slight_smile:

Thanks for the update BlackPanda. Will install again and try it fresh !

I managed to reproduce bug in as simple form as possible. Source: https://drive.google.com/folderview?id=0B2XhU61Ilrv3R19fd1JmeWp2SG8&usp=sharing
For me, try/catch block simply doesn’t work in Android plugins. Tested on Nexus 5, Lolipop 5.0.1 LRX22C. Can someone confirm that?

I filled bug report of course.

Yes i came to this same conclusion. But it happens not only when app is downloaded from google play.

We’re also having issues with Unity 4.6.2 building and a crash on a Nexus 6 running android 5.0.1, about a split second after splash screen. It’s working on other devices running older android though.

From my experience this issue was fixed in 4.6.3.