7

When request permissions, the system show an error message, "System UI has stopped" and keeps restarting until you give the permissions;

E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.android.systemui, PID: 3910
              java.lang.NullPointerException: Attempt to invoke virtual method 'void com.android.systemui.statusbar.phone.NavigationBarFragment.onKeyguardOccludedChanged(boolean)' on a null object reference
                  at com.android.systemui.statusbar.phone.StatusBar.onKeyguardOccludedChanged(StatusBar.java:3843)
                  at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.setOccluded(StatusBarKeyguardViewManager.java:277)
                  at com.android.systemui.keyguard.KeyguardViewMediator.handleSetOccluded(KeyguardViewMediator.java:1176)
                  at com.android.systemui.keyguard.KeyguardViewMediator.-wrap14(Unknown Source:0)
                  at com.android.systemui.keyguard.KeyguardViewMediator$4.handleMessage(KeyguardViewMediator.java:1531)
                  at android.os.Handler.dispatchMessage(Handler.java:105)
                  at android.os.Looper.loop(Looper.java:164)
                  at android.app.ActivityThread.main(ActivityThread.java:6541)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

I've tried those answers[1][2], none of them solved my problem. This is happening only in the emulator, on physical devices it's OK;

[1] Unfortunately System UI has stopped

[2] Android Studio gradle Error: your emulator is out of date

João Carlos
  • 1,405
  • 1
  • 15
  • 21
  • I had the same error on the Pixel and Pixel 2 emulators with Android 8. My quick fix without reconfiguring anything (my only requirement was to test my application on an Android 8): I switched to a Nexus 6 emulator with Android 8 and the error already did not reappear. – cesargastonec Sep 07 '20 at 21:53

2 Answers2

10

May be its too late but this might help others, its a bug on the emulator's soft buttons, the workaround is to increase the resolution of the emulator and don't forget to add soft-button. This helped me out

Maher
  • 342
  • 3
  • 10
0

This issue happend too for me. I can confirm @Mather's solution as a workaround when developing.

But the problem for me was, changing the screen resolution and adding soft-buttons was no opportunity since the app is productive and our users won't buy a new phone.

What was my fix?
Basically permit the permissions via system settings:
Close app -> System Settings -> Apps & notifications -> App info -> Select myApp -> Permissions -> Permit all unchecked permissions

Marcel Hofgesang
  • 951
  • 1
  • 15
  • 36