Search Unity

Crash sessions increase to 4% with 5.4 Android build

Discussion in 'Android' started by tbll, Aug 29, 2016.

  1. tbll

    tbll

    Joined:
    Jan 19, 2013
    Posts:
    31
    Hi Unity community,

    Our dev team has recently updated our Unity version to 5.4.0p1 and published a new version of our app. With crashlytics, we immediately saw a big increase in crash sessions to 4% (from 99.7% to 96.5% of crash-free sessions). (stack traces shown below)

    Any idea where could it come from?

    We are thinking about going back to 5.3.5p8, what do you think?


    Thanks in advance,

    Thibault

    ---

    FYI, here is some of the stack traces we received:

    Fatal Exception: java.lang.Error
    FATAL EXCEPTION [main] Unity version : 5.4.0p1 Device model : UMI TOUCH UMI TOUCH Device fingerprint: alps/full_n625ab/n625ab:6.0/MRA58K/1462868349:user/test-keys

    Caused by java.lang.RuntimeException
    android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4065)
    android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:4083)
    android.app.ActivityThread.-wrap5 (ActivityThread.java)
    android.app.ActivityThread$H.handleMessage (ActivityThread.java:1542)
    android.os.Handler.dispatchMessage (Handler.java:111)
    android.os.Looper.loop (Looper.java:207)
    android.app.ActivityThread.main (ActivityThread.java:5728)
    java.lang.reflect.Method.invoke (Method.java)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:789)
    com.android.internal.os.ZygoteInit.main (ZygoteInit.java:679)

    Caused by java.lang.NullPointerException
    android.os.Message.sendToTarget (Message.java:429)
    com.unity3d.player.UnityPlayer$b.a (Unknown Source)
    com.unity3d.player.UnityPlayer$b.a (Unknown Source)
    com.unity3d.player.UnityPlayer.quit (Unknown Source)
    com.unity3d.player.UnityPlayerActivity.onDestroy (Unknown Source)
    android.app.Activity.performDestroy (Activity.java:6479)
    com.android.internal.os.ZygoteInit.main (ZygoteInit.java:679)

    Caused by java.lang.Error
    libunity.0055d2d8 (Unknown Source)
    libunity.00549ed4 (Unknown Source)
    libunity.0037eb41 (Unknown Source)
    libunity.0037da0f (Unknown Source)
    libunity.0049438b (Unknown Source)
    libunity.0049421a (Unknown Source)
    libunity.00496bdd (Unknown Source)
    libunity.00498010 (Unknown Source)
    libunity.00101df0 (Unknown Source)
    libunity.0014db36 (Unknown Source)
    libunity.0014f12a (Unknown Source)
    libunity.002134d2 (Unknown Source)
    libunity.0043558a (Unknown Source)
    libunity.005953ee (Unknown Source)
    libunity.00597a93 (Unknown Source)
    libdvm.dvmPlatformInvoke (dvmPlatformInvoke:86)
    libdvm.dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*) (dvmCallJNIMethod:413)
    Unknown.00008ea8 (Unknown Source)
    Unknown.10f80044 (Unknown Source)

    Fatal Exception: java.lang.Error
    FATAL EXCEPTION [main] Unity version : 5.4.0p1 Device model : unknown GI-I9500_TMMARS Device fingerprint: Samsung/full/generic:4.1.1/JRO03R/eng.mars.20160624.050315:eng/test-keys

    Caused by java.lang.RuntimeException

    android.app.ActivityThread.handleReceiver (ActivityThread.java:2274)
    dalvik.system.NativeStart.main (NativeStart.java)

    Caused by java.lang.NullPointerException
    com.androidnative.gcm.GcmBroadcastReceiver.onReceive (GcmBroadcastReceiver.java:54)
    android.app.ActivityThread.handleReceiver (ActivityThread.java:2267)
    android.app.ActivityThread.access$1500 (ActivityThread.java:131)
    dalvik.system.NativeStart.main (NativeStart.java)

    Caused by java.lang.Error
    libpvrANDROID_WSEGL_SGX540_120.00000b0c (Unknown Source)
    libsrv_um_SGX540_120.PVRSRVUnlockMutex (PVRSRVUnlockMutex:204)
     
  2. tbll

    tbll

    Joined:
    Jan 19, 2013
    Posts:
    31
    Bump!
     
  3. tbll

    tbll

    Joined:
    Jan 19, 2013
    Posts:
    31
    Hi,

    @Unity administrators : I can of course provide more info if you need some. But I really need help on that. This is affecting our production app and since we reached 1k download / day, it has big impact.

    Thanks in advance.

    PS : A new error that I don't understand:
    Caused by java.lang.Error
    libunity.004d58ac (Unknown Source)
    libunity.00335fa4 (Unknown Source)
    libunity.003101f8 (Unknown Source)
    libunity.00360c30 (Unknown Source)
    libunity.0050cdb0 (Unknown Source)
    libunity.0050fb3c (Unknown Source)
    libdvm.dvmPlatformInvoke (dvmPlatformInvoke:112)
    libdvm.dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*) (dvmCallJNIMethod:398)
    libdvm.00029ae0 (Unknown Source)
    libdvm.dvmMterpStd(Thread*) (dvmMterpStd:76)
    libdvm.dvmInterpret(Thread*, Method const*, JValue*) (dvmInterpret:184)
    libdvm.dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list) (dvmCallMethodV:336)
    libdvm.dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...) (dvmCallMethod:20)
    libdvm.000584f7 (Unknown Source)
    libc.__thread_entry (__thread_entry:44)
    libc.pthread_create (pthread_create:316)
     
    garfmedya likes this.
  4. Yuri-Kimo

    Yuri-Kimo

    Joined:
    Apr 3, 2013
    Posts:
    6
    Hi, did you have any answer about this problem? We are having the same issue.
     
  5. tbll

    tbll

    Joined:
    Jan 19, 2013
    Posts:
    31
    Nop :/
     
  6. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @tbll can you reproduce it locally? If not - it's hard to say anything based on the crash in the wild on _some_ device on _some_ unity version.
     
  7. mferreiro_sgn

    mferreiro_sgn

    Joined:
    Nov 11, 2015
    Posts:
    1
    We are experiencing the same issue. One piece of information I can add to this is that it only occurs in Android OS 6.0 (is the only os version reported), and we have started seeing this after updating to Unity 5.5.1f1 (from Unity 5.3.4f1)
     
  8. Tx

    Tx

    Joined:
    Jul 4, 2012
    Posts:
    108
    Here too we have the same issue. Unity 5.6.0f3 and Android OS 6.0.
    Any idea? I'm pretty fed up of being insulted by users for these issues.
     
  9. archoliver

    archoliver

    Joined:
    Jul 4, 2014
    Posts:
    5
    Same issue. Please help.
    Unity 5.6.1f1
    Android 6.0
     
  10. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Folks, we can't fix your issues if the only details is your post saying "same issue".
    Please make sure you can reproduce it locally, then submit a bug report, attach the project and provide the details about your device.
     
  11. 3gogames

    3gogames

    Joined:
    Jul 28, 2015
    Posts:
    31
    We've registered a lot of crashes like that using Crashlytics.

    Here is an example for the stackstrace:

    Fatal Exception: java.lang.Error
    FATAL EXCEPTION [main] Unity version : 5.6.3f1 Device model : leimin i7 Plus Device fingerprint: alps/aeon6580_weg_m_l8/aeon6580_weg_m_l8:6.0/MRA58K/1488246121:user/test-keys

    Caused by java.lang.NullPointerException
    android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4024)
    android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:4083)
    android.app.ActivityThread.-wrap5 (ActivityThread.java)
    android.app.ActivityThread$H.handleMessage (ActivityThread.java:1542)
    android.os.Handler.dispatchMessage (Handler.java:111)
    android.os.Looper.loop (Looper.java:207)
    android.app.ActivityThread.main (ActivityThread.java:5728)
    java.lang.reflect.Method.invoke (Method.java)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:789)
    com.android.internal.os.ZygoteInit.main (ZygoteInit.java:679)

    Some devices affected:

    Lenovo VIBE K10
    Lenovo A2016b30
    Lenovo TAB 3 850F

    ZTE BLADE A510
    ZTE BLADE A210

    Acer B3-A30

    Unfortunately we don't know a repro-step and we have never reproduced it on our devices...But users worldwide have many of them.

    Any idea? Can you help us?
     
  12. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @3gogames the build fingerprint you pasted reveals 0 results in google, apart from this page. In addition, "test-keys" assume this is not an official ROM - otherwise it would have been "release-keys".
     
  13. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    We also see the same crash across multiple separate apps with 2017.3. The device fingerprints do not appear to be rooted in this case (Crashlytics also shows "100% rooted" on some of our crashes, but not this one.) I just thought I'd append to this thread as it seems to be a somewhat reasonable google hit for this issue.

    Whilst I have sympathy for Unity developers saying "we can't fix without a repro" as that is unquestionably true, it seems odd that Unity has mandated analytics collection on all IAPs, but hasn't yet turned Unity Performance reporting into a solution that internally allows Unity to *know* the top 100-or-so crashes Unity users are seeing in the wild, so that further investigation can take place. Note that our crashlytics integration in this case is because Unity Performance Reporting currently has multiple issues with non-managed exceptions (aka "crashes") that are being addressed, the existence of which in turn gives me low confidence that any professional game developers are using Unity Perf Reporting for this purpose.
     

    Attached Files:

  14. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @ferretnt we are listening to you. :)

    I forwarded your message to Performance reporting services team.

    Your crash looks bad; we are updating the code around the looper in 2017.3.1p2 (planned soon) - maybe it fixes your issue, but it may very well be outside of the looper. You know, having at least logcat of a development version would help; having a bug report with a project would help even more. ;)
     
    ferretnt likes this.
  15. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Thanks - will migrate to this patch as soon as it's available on UCB.

    As of this morning, this crash in performDestroyActivity accounts for 70% of all crashes we see on Google Play Developer console. (The remaining few are low-repro crashes within GLES2 Blit()s, and given that our whole app is built around lots of rendertextures and Blit()s, and I don't trust most Android GPU drivers as far as I can throw them, there's probably not much Unity can do there...)

    Unfortunately, I still can't reproduce it locally, and I don't even have crashlytics anymore, because to eliminate all the other crashes I had to move Appodeal to gradle and multidex, and multidex required overriding the android activity, as does Crashlytics, and I couldn't be bothered subclassing to handle both before releasing the test build...

    So I apologize for the grumpy forum post. Sometimes, as an "indie" these days you just have a bad day where you spend 3 days chasing low-repro stability bugs across your usage of a pile of other large companies' systems (in this case Unity, Appodeal and Firebase) and just end up ranting a bit because it's your app that pays the price when stability is low. (Google is especially scientific at making sure you pay this price for crashes, yet firebase and admob are not innocent when it comes to crash sources...)
     
  16. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Is there any way to tell if others have managed to repro this on a local device? After clearing up a huge number of other issues in my apps (mostly related to multidex and ad libraries), variations of this DestroyActivity call stack account for 100% of the crashes reported in google play developer console for my apps.

    Note that 89 crashes isn't an *enormous* number (that's from ~50k sessions), but it's still disproportionately high in an app that we've worked pretty hard to fix all the crash bugs in.

    A.
     

    Attached Files:

  17. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    I may have a clue for you.

    All the devices I've seen in your crashes are x86.

    - are you shipping x86 version of your game?
    - are all the native libraries present for x86? otherwise, the device will go into armv7 emulation mode, where you have another axis of instability caused by the emulator
    - maybe you have a asus x86 device to check on.
     
  18. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Hmm, we explicitly don't support X86 (ARM only, because it saves binary size, and we can't fit under 100Mb with a universal binary), and I *thought* I'd seen some ARM devices in the crashes (I more or less default my reaction to ignore for X86 crashes, especially when they're because libhoudini thinks it can be clever and can't.)

    I'll take another look through my list and confirm there are ARM devices having the issue too because if not that's pretty bad of me not to realize.

    I wonder if I need to get super-agressive and eliminate X86 by shipping multiple APKs (potentially rip out any third-party libs from the X86 APK just to be sure because, let's be honest, who cares about anything other than those tiny fraction of users getting a binary that doesn't crash.)
     
    Last edited: Feb 23, 2018
  19. dandepeched

    dandepeched

    Joined:
    Feb 22, 2016
    Posts:
    31
    Looks like similar crash appears for my game. Sadly I cannot reproduce it locally.
    I deliver both arm and x86 apks (x86 has higher version), but this one with crash is arm apk.

    Here are details, just to collect some statistics:
    # OS Version: 5.1
    # Device: GI-I9500_TMMARS
    Device fingerprint: Samsung/unia_x86/vmi:5.1/LMY47D/roland10201431:userdebug/test-keys
    Unity version : 2017.3.0f3

    Full report attached.
     

    Attached Files:

    Last edited: Mar 16, 2018
  20. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Correct.
    I'm not sure if x86 APK is preferred over ARM if it does not have all the libraries... Maybe it was related to a FAT APK. Probably if the x86 version has a higher version code - it will be preferred by x86 devices. So multiple APKs are definitely worth trying.
     
  21. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    This is not an official ROM.
     
  22. Oscar-Tsang

    Oscar-Tsang

    Joined:
    Nov 7, 2012
    Posts:
    84
    All my apps in Google play also have many this crashes log. But I haven't find a way to reproduce it.
    But I have one times to make it happen, by calling "Application.quit()".

    Is it help for unity to fixed this bug?
    Or can Unity upload their demo game to Google play, let more people use it. I think Unity will see this error message.

    Is it possible, this error is cased by Google injected code, because when upload to google play, google will inject some code to your apk before let user download it?

    Unity 2017.4

    exception.class.missing._Unknown_: java.lang.NullPointerException Attempt to invoke virtual method 'boolean android.os.Handler.sendMessage(android.os.Message)' on a null object reference Message.java 422 java.lang.Error: FATAL EXCEPTION [main] Unity version : 2017.4.1f1 Device model : vivo vivo 1723 Device fingerprint: vivo/1723/1723:8.1.0/OPM1.171019.011/compil03290044:user/release-keys Caused by

    at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4489)

    at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:4507)

    at android.app.ActivityThread.-wrap5 (Unknown Source)

    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1704)

    at android.os.Handler.dispatchMessage (Handler.java:106)

    at android.os.Looper.loop (Looper.java:192)

    at android.app.ActivityThread.main (ActivityThread.java:6668)

    at java.lang.reflect.Method.invoke (Method.java)

    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)

    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:818)
    Caused by: java.lang.NullPointerException:

    at android.os.Message.sendToTarget (Message.java:422)

    at com.unity3d.player.UnityPlayer$e.a (UnityPlayer.java:8)

    at com.unity3d.player.UnityPlayer$e.a (UnityPlayer.java:2)

    at com.unity3d.player.UnityPlayer.quit (UnityPlayer.java:25)

    at com.unity3d.player.UnityPlayerActivity.onDestroy (UnityPlayerActivity.java:2)

    at android.app.Activity.performDestroy (Activity.java:7316)

    at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1255)

    at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4476)

    at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:4507)

    at android.app.ActivityThread.-wrap5 (Unknown Source)

    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1704)

    at android.os.Handler.dispatchMessage (Handler.java:106)

    at android.os.Looper.loop (Looper.java:192)

    at android.app.ActivityThread.main (ActivityThread.java:6668)

    at java.lang.reflect.Method.invoke (Method.java)

    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)

    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:818)
     
  23. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Can you please file a bug report, including the project and the device data. Feel free to post the case # here. Thank you!
     
  24. tinyfishgames

    tinyfishgames

    Joined:
    Dec 11, 2016
    Posts:
    13
    I am also facing same crash with my game built with Unity 2018.1.1
     
  25. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    Any progress?

    Unity version: 2017.3.1f1

    Fingerprints:
    Lenovo/LenovoTB3-X70L/TB3-X70L:6.0/MRA58K/TB3-X70L_S000003_170213_ROW_P:user/release-keys
    Lenovo/LenovoTB3-X70L/TB3-X70L:6.0/MRA58K/TB3-X70L_S000004_170411_ROW_P:user/release-keys
    Lenovo/LenovoTB3-850M/TB3-850M:6.0/MRA58K/TB3-850M_S100029_160924_ROW:user/release-keys
    Lenovo/TB3-730X/TB3-730X:6.0/MRA58K/TB3-730X_S039_171011_ROW:user/release-keys

    samsung/GT-P7500/GT-P7500:4.0.4/IMM76D/XXLQ8:user/release-keys
    samsung/a3ltexx/a3lte:5.0.2/LRX22G/A300FXXU1BQB2:user/release-keys
    samsung/greatqltecs/greatqltecs:4.4.2/NMF26X/381180710:user/release-keys

    Xiaomi/nikel/nikel:6.0/MRA58K/V9.6.1.0.MBFMIFD:user/release-keys

    ZTE/P635T36/ZTE_BLADE_A610:6.0/MRA58K/20161030.104350:user/release-keys
    ZTE/P635T36/ZTE_BLADE_A610:6.0/MRA58K/20160913.200420:user/release-keys
    ZTE/P653A10_RU_CHANNEL/P653A10:6.0/MRA58K/20160505.120314:user/release-keys

    HOMTOM/HOMTOM/aeon6737m_65_m0:6.0/MRA58K/1471951439:user/test-keys
    OUKITEL/full_hct6753_66_m0/hct6753_66_m0:6.0/MRA58K/1486461188:user/test-keys

    In most cases this crash happens only when user quits the application:
    at com.unity3d.player.UnityPlayer.quit (Unknown Source)
    at com.unity3d.player.UnityPlayerActivity.onDestroy (Unknown Source)
    at android.app.Activity.performDestroy (Activity.java:6479)
    at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1149)
    at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4052)

    , but lately I've got another entry point:
    at com.unity3d.player.UnityPlayer.windowFocusChanged (Unknown Source)
    at com.unity3d.player.UnityPlayerActivity.onWindowFocusChanged (Unknown Source)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.onWindowFocusChanged (PhoneWindow.java:3252)
    at android.view.View.dispatchWindowFocusChanged (View.java:8921)
    at android.view.ViewGroup.dispatchWindowFocusChanged (ViewGroup.java:1161)
    at android.view.ViewRootImpl$ViewRootHandler.handleMessage (ViewRootImpl.java:3257)

    The crash is always here:
    at android.os.Message.sendToTarget (Message.java:429)
    at com.unity3d.player.UnityPlayer$c.a (Unknown Source)
    at com.unity3d.player.UnityPlayer$c.a (Unknown Source)

    This is the internal implementation of UnityPlayer$c.a:
    final class UnityPlayer$c extends Thread
    {
    Handler a;
    ...
    private void a(UnityPlayer.b paramb)
    {
    Message.obtain(this.a, 2269, paramb).sendToTarget();
    }
    ...
    public final void run()
    {
    ...
    this.a = new Handler(
    ...
    }

    According to Google the method sendToTarget throws a null pointer exception if target field has not been set. Private field "a" initialized only once in the "run" method. I've found no other usages of initialization of this handler in all UnityPlayer java classes.

    1.) So the real question is why this handler is null before UnityPlayer completes its quit cycle?
    2.) The other thing is this also happens on event "windowFocusChanged". In this case instead of "quit" message, this code trying to send "focus_gained" or "focus_lost" messages.

    Changing the window focus seems an easy way to reproduce this crash. But nor on real device nor on emulator I can not achieve it.
     
    Last edited: Aug 15, 2018
  26. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    Ok, another update:

    I am pretty sure this crash only happens when player is exiting app.
    Changing window focus does the trick so I finally able to reproduce rare situation with discussed crash:
    (I've test this on emulator only in Android studio)
    1. Create new project in Unity, add canvas, add button, add button click handler wich just quits the app.
    2. Run emulator in Android studio, install app, click on emulator control panel "3 dots" button to show extended controls.
    3. Select "phone" and then click "call device".
    4. Now it's a tricky part, while you see incoming notification window with "dismiss" and "answer" buttons you have to press your app button to quit and immediately "dismiss" button on notification window.
    5. The call will be dismissed and app will gone to background.
    6. Start the app again either from the icon or from recent list you will see the message about app being stopped.

    If the app started without error then you just press "dismiss" button too late. I can easily crash app this way 3 out of 5 times.

    Despite the fact that console show that crash happens in "onWindowFocusChanged" event I think it is still the app's "quit" cycle because the app process is alive but is in background. So when you start app again OS tries resume app state and app tries to finish it "quit" logic. There is a function named "windowFocusChanged" inside UnityPlayer which handles window focus state changes. Unlike some other functions wich aware of "quit" and use function "isFinishing" this one does not use it.

    That's all I've got so far. Still not able to reproduce clear crash with UnityPlayer.quit() method.
     
  27. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
     
  28. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    Yury, does it worth it?

    I mean this repro is about NPE in "UnityPlayer.windowFocusChanged"(I have not seen this crash is mentioned here on forums ever) but not about NPE in "UnityPlayer.quit" method which is discussed here?
     
  29. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
  30. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Thanks, I'll make sure it gets enough attention!
     
  31. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    Well, I've got the answer from QA team: "Unfortunately, we are not supporting virtual devices ..." :)
    I'll see if I can reproduce it on some real device ...
     
    Yury-Habets likes this.
  32. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    139
    Fix needed guys
     
  33. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    139
  34. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    Nope, no luck. On real device this repro is not working.
     
  35. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    Ok, after a bit of thinking I guess I found a real reason why this crash really happens.

    There is no way this could happen in normal circumstances, so I started over from the blank. What do we we have at the beginning:

    1. A null pointer exception thrown at application's quit logic while trying to send message from one thread to another thus a handler in UnityPlayer$c class is null (here and futher I will use java decompiled classes names from Unity 2017.3.1f1, see my post above)

    2. UnityPlayer$c is a thread and creates its handler only in method "run" thus to have initialized handler one must start this thread so the method "run" will be executed when OS will create and run a native thread.

    3. UnityPlayer$c (thread) is created when UnityPlayer class is created (as a private field) and started at the end of the constructor.

    To sum up
    : if UnityPlayer is created successfully then the helper thread UnityPlayer$c is also created and started. This lead us to analyze only constructor of the UnityPlayer which has this pretty code:

    Code (JavaScript):
    1.  public UnityPlayer(Context paramContext)
    2.   {
    3.  
    4.     // Some code skipped for readability
    5.  
    6.     for (;;)
    7.     {
    8.       // Load some native stuff and put result to "l"
    9.       a(this.n.getApplicationInfo());
    10.  
    11.       // Check result, if all ok then break this loop and continue with initialization
    12.       if (l.c()) {
    13.         break;
    14.       }
    15.  
    16.       // Some error happened while loading native stuff
    17.       AlertDialog localAlertDialog = new AlertDialog.Builder(this.n).setTitle("Failure to initialize!").setPositiveButton("OK", new UnityPlayer.13(this)).setMessage("Your hardware does not support this application, sorry!").create();
    18.       localAlertDialog.setCancelable(false);
    19.       localAlertDialog.show();
    20.  
    21.       // HERE: just return from the constructor!!!
    22.       // HERE: helper thread which is "this.a" IS NOT STARTED
    23.       return;
    24.       label257:
    25.       this.e.d();
    26.     }
    27.  
    28.     // Some code skipped for readability
    29.  
    30.     // HERE: This is the very end of the constructor and the thread is finally started so its handler is created.
    31.     this.a.start();
    32.   }
    I have no idea how to simulate error while loading native Unity stuff so I used brute force :) I just patched classes.dex inside apk so result from NativeLoader is always false. As expected I got message "Failure to initialize" and ... a crash with null pointer exception.

    Next step was just download every crash from developers console and analyze crashes timestamps:
    1. as a rule this crash happens several times with one user
    2. as a rule user trying to start app several times so timestamps almost the same within one or two minutes

    The real reason of this crash is invalid error handling in UnityPlayer class so the UnityPlayerActivity does not know anything about initialization errors.

    As I mentioned before there is another entry point for this crash at "windowFocusChanged" method. I posted an investigation above and still pretty sure that I am right about my repro (to exploit it in real life you have to have low level device = a not very fast one :))

    And lastly, I've downloaded Unity 2018.2.13f1 and check out android player and ... all this stuff is still there :)

    @Yury-Habets can you pay attention to this post? Frankly I dont know how to file a crash report about this ... :)

    ps:
    And I hope guys from Unity will patch this minor error not only in current build but in 2017.3.1f1.
     
    Yury-Habets likes this.
  36. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @CybIam thanks for the great investigation!

    @Ignas83 was so nice to fix this issue for 19.1; backports may follow too.
     
  37. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    May follow or will follow?
    :cool:
     
  38. reddy36996

    reddy36996

    Joined:
    Jan 10, 2016
    Posts:
    19
    We started seeing this crash issue in console after publishing last week.
    Effected devices : Zen M72 Smart , Gionee P5L , Gionee P6
    Stack Trace :
    Code (CSharp):
    1. java.lang.Error: FATAL EXCEPTION [main] Unity version : 2018.2.11f1 Device model : GiONEE P5L Device fingerprint: GiONEE/P5L/GiONEE_WBL7352:5.1/LMY47D/1494906399:user/release-keys Caused by
    2. at android.os.Message.sendToTarget (Message.java:429)
    3. at com.unity3d.player.UnityPlayer$e.c (Unknown Source)
    4. at com.unity3d.player.UnityPlayer.b (Unknown Source)
    5. at com.unity3d.player.UnityPlayer.a (Unknown Source)
    6. at com.unity3d.player.UnityPlayer.a (Unknown Source)
    7. at com.unity3d.player.UnityPlayer$17.surfaceCreated (Unknown Source)
    8. at android.view.SurfaceView.updateWindow (SurfaceView.java:695)
    9. at android.view.SurfaceView$3.onPreDraw (SurfaceView.java:210)
    10. at android.view.ViewTreeObserver.dispatchOnPreDraw (ViewTreeObserver.java:944)
    11. at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2348)
    12. at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1292)
    13. at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:6598)
    14. at android.view.Choreographer$CallbackRecord.run (Choreographer.java:800)
    15. at android.view.Choreographer.doCallbacks (Choreographer.java:603)
    16. at android.view.Choreographer.doFrame (Choreographer.java:572)
    17. at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:786)
    18. at android.os.Handler.handleCallback (Handler.java:815)
    19. at android.os.Handler.dispatchMessage (Handler.java:104)
    20. at android.os.Looper.loop (Looper.java:194)
    21. at android.app.ActivityThread.main (ActivityThread.java:5653)
    22. at java.lang.reflect.Method.invoke (Native Method)
    23. at java.lang.reflect.Method.invoke (Method.java:372)
    24. at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:960)
    25. at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:755)
    26.  
    @Yury-Habets Any update on this crash issue?
     
  39. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    I requested backports for 17.4 and 18.3. It may take some time though.
     
  40. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    Thanks!
     
  41. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    HELP NEEDED
    1. java.lang.Error: FATAL EXCEPTION [main]
    2. Unity version : 2017.4.12f1
    3. Device model : OnePlus ONEPLUS A3003
    4. Device fingerprint: OnePlus/OnePlus3/OnePlus3T:8.0.0/OPR1.170623.032/1807192224:user/release-keys
    5. Caused by
    6. at android.os.Message.sendToTarget (Message.java:418)
    7. at com.unity3d.player.UnityPlayer$e.a (Unknown Source:8)
    8. at com.unity3d.player.UnityPlayer$e.c (Unknown Source:2)
    9. at com.unity3d.player.UnityPlayer.windowFocusChanged (Unknown Source:24)
    10. at com.unity3d.player.UnityPlayerActivity.onWindowFocusChanged (Unknown Source:5)
    11. at com.android.internal.policy.DecorView.onWindowFocusChanged (DecorView.java:1563)
    12. at android.view.View.dispatchWindowFocusChanged (View.java:12029)
    13. at android.view.ViewGroup.dispatchWindowFocusChanged (ViewGroup.java:1387)
    14. at android.view.ViewRootImpl$ViewRootHandler.handleMessage (ViewRootImpl.java:3901)
    15. at android.os.Handler.dispatchMessage (Handler.java:105)
    16. at android.os.Looper.loop (Looper.java:164)
    17. at android.app.ActivityThread.main (ActivityThread.java:6798)
    18. at java.lang.reflect.Method.invoke (Native Method)
    19. at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
    20. at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)
    Please rectify android.os.Message.sendToTarget bug i am daily getting 5-10 crashes in developer console,now it has started to impact my game reviews and ratings.

    In the mean time do let us know what we can do to avoid sudden crashes(may be close some Unity API calls)?.
     
  42. SkillCap

    SkillCap

    Joined:
    Nov 10, 2016
    Posts:
    2
    Any ETA for backports for 2017.4?
     
  43. AlexFreeman

    AlexFreeman

    Joined:
    Sep 29, 2016
    Posts:
    12
    the same issue
     
  44. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    Bump!
     
  45. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    139
  46. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    2018.3.0f1 has the fix.
    2017.4 backport hasn't had enough attention yet. I'll make sure it gets high priority.
     
    sysper and AcidArrow like this.
  47. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    It's strange that here https://unity3d.com/unity/whats-new/unity-2018.3.0 no mention of this fix. I've seen this update in december...
     
  48. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @CybIam here:
    https://unity3d.com/unity/beta/2018.3.0f1
    • Mobile: Fix crash that happens if native library initialization fails for any reason. (1097014)
    The case number doesn't match because this is a subcase for backporting into 2018.3.
     
    AcidArrow likes this.
  49. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    Got it.
     
  50. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    139
    thank you @Yury-Habets .We need fix in Unity LTS version...