Skip to content

NPE in PlatformViewsController.getDisplayDensity #114095

@jacobsimionato

Description

@jacobsimionato

Copied from internal bug b/254856490 which has more context and part of a fix suggestion.

We're seeing ~400 crashes per day in a launched production app with the stack trace below. We're seeing the crashes primarily (60%) on Android 30 devices, and mostly affecting Samsung devices.

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
	at io.flutter.plugin.platform.PlatformViewsController.getDisplayDensity(PlatformViewsController.java:953)
	at io.flutter.plugin.platform.PlatformViewsController.toLogicalPixels(PlatformViewsController.java:961)
	at io.flutter.plugin.platform.PlatformViewsController.-$$Nest$mtoLogicalPixels(Unknown Source:0)
	at io.flutter.plugin.platform.PlatformViewsController$1.lambda$resize$2$io-flutter-plugin-platform-PlatformViewsController$1(PlatformViewsController.java:468)
	at io.flutter.plugin.platform.PlatformViewsController$1$$ExternalSyntheticLambda2.run(D8$$SyntheticClass:6)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:223)
	at android.app.ActivityThread.main(ActivityThread.java:7815)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1094)

Metadata

Metadata

Labels

P0Critical issues such as a build break or regressioncustomer: huggsy (g3)platform-androidAndroid applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions