Cocos2d-x 3.17 Android crashes with NullPointerException in org.cocos2dx.lib.Cocos2dxHelper.runOnGLThread

Anyone have any clue on this null pointer? Getting bunch of them in Google console using 3.17. Thanks!

java.lang.RuntimeException: 
  at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4897)
  at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:4915)
  at android.app.ActivityThread.access$1600 (ActivityThread.java:211)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1759)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:145)
  at android.app.ActivityThread.main (ActivityThread.java:6946)
  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:1404)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1199)
Caused by: java.lang.NullPointerException: 
  at org.cocos2dx.lib.Cocos2dxHelper.runOnGLThread (Cocos2dxHelper.java:109)
  at org.cocos2dx.lib.Cocos2dxAudioFocusManager.unregisterAudioFocusListener (Cocos2dxAudioFocusManager.java:122)
  at org.cocos2dx.lib.Cocos2dxActivity.onDestroy (Cocos2dxActivity.java:230)
  at android.app.Activity.performDestroy (Activity.java:6809)
  at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1169)
  at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:4875)

Same problem?
3.16 version helloworld project crash when add SplashActivity #18884

@daisuke7 looks like it might be same problem. Thank you!

1 Like

@slackmoehrle anyway your team can look into this? We are seeing a lot of these crashes in the Play Console.

Look like this fix below is causing NullPointerException .

@drelaptop do you have any thoughts?

1 Like

I think below is a better solution, please refer to

@drelaptop to clarify should we keep the hack code block below?

yes, for the origin issue the hack code solved didn’t been solved, this comment

1 Like