filament icon indicating copy to clipboard operation
filament copied to clipboard

[Android] DisplayHelper #updateDisplayInfo NullPointerException

Open Junxiao123 opened this issue 2 months ago • 4 comments

When using ModelView to load a .glb model following the official demo, everything works fine under normal conditions. However, during stress testing (running Monkey), an issue occurs where mRender becomes null in DisplayHelper’s updateDisplayInfo method.

Version: 1.64.0

FATAL EXCEPTION: main Process: com.xx.xxx, PID: 28940 java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.filament.Renderer$DisplayInfo com.google.android.filament.Renderer.getDisplayInfo()' on FloatBallTextAdapter null object reference at com.google.android.filament.android.DisplayHelper.updateDisplayInfo(Unknown Source:136) at w2.DisplayHelper.-$$Nest$mupdateDisplayInfo(Unknown Source:0) at com.google.android.filament.android.DisplayHelper$1.onDisplayChanged(Unknown Source:102) at android.hardware.display.DisplayManagerGlobal$DisplayListenerDelegate.handleMessage(DisplayManagerGlobal.java:1166) at android.hardware.display.DisplayManagerGlobal$DisplayListenerDelegate.lambda$sendDisplayEvent$0(DisplayManagerGlobal.java:1133) at android.hardware.display.DisplayManagerGlobal$DisplayListenerDelegate.$r8$lambda$aO0d1U2yv7-42_0MvY8uEf7AtpE(Unknown Source:0) at android.hardware.display.DisplayManagerGlobal$DisplayListenerDelegate$$ExternalSyntheticLambda0.run(Unknown Source:6) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8225) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:573) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1058)

Junxiao123 avatar Oct 23 '25 03:10 Junxiao123

we need more info. Please provide detailed repro steps.

pixelflinger avatar Oct 31 '25 21:10 pixelflinger

we need more info. Please provide detailed repro steps.

This issue doesn’t occur consistently and doesn’t appear during normal usage. It only happens occasionally during Monkey stress testing.

My current fix is to manually compile the Filament Android library and add a null check for mRenderer in DisplayHelper.java within the updateDisplayInfo method. With this change, everything works normally, and the same Monkey stress test no longer triggers the issue. Image

Junxiao123 avatar Nov 04 '25 03:11 Junxiao123

@Junxiao123 if you're getting this crash from crashlytics, can you confirm the percentage marked as Background? This can be found on the crash page on the Data Insights section.

bennysway avatar Nov 24 '25 13:11 bennysway

@bennysway I'm facing this exact issue as well, and the background percentage is 2% in my case.

mmartosdev-wkl avatar Nov 24 '25 14:11 mmartosdev-wkl