capacitor-community / screen-brightness

MIT License
23 stars 8 forks source link

CRASH #14

Closed bounteous-alisWard closed 6 months ago

bounteous-alisWard commented 10 months ago

Describe the bug This has been our top crash for a long time. Looking for advice if we need to repair on our end, or fix if needs to be repaired on your end.

com.elylucas.capscreenbrightness.ScreenBrightnessPlugin.lambda$setBrightness$0
java.lang.NullPointerException - Attempt to invoke virtual method 'float java.lang.Float.floatValue()' on a null object reference

Android 7:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'float java.lang.Float.floatValue()' on a null object reference
       at com.elylucas.capscreenbrightness.ScreenBrightnessPlugin.lambda$setBrightness$0(ScreenBrightnessPlugin.java:22)
       at com.elylucas.capscreenbrightness.ScreenBrightnessPlugin$$ExternalSyntheticLambda0.run(D8$$SyntheticClass)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6836)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

Android 14:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'float java.lang.Float.floatValue()' on a null object reference
       at com.elylucas.capscreenbrightness.ScreenBrightnessPlugin.lambda$setBrightness$0(ScreenBrightnessPlugin.java:22)
       at com.elylucas.capscreenbrightness.ScreenBrightnessPlugin$$ExternalSyntheticLambda0.run(:8)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:230)
       at android.os.Looper.loop(Looper.java:319)
       at android.app.ActivityThread.main(ActivityThread.java:8893)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

To Reproduce Steps to reproduce the behavior: Unsure. We do have one screen with automatic screen brightness increased to max, and then we decrease it when you leave screen again, but I've never been able to produce this crash locally.

Expected behavior No crash

Smartphone (please complete the following information):

Additional context ionic v7 (crash also observed with ionic 6), node & npm, angular (web)

41% In background 0% Rooted 100% Proximity on

bounteous-alisWard commented 10 months ago

Related crash with iOS. I say related, because it's not reporting setBrightness as the crash, but _userInfoForFileAndLine, after setBrightness. If interested:

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                        0xec870 __exceptionPreprocess
1  libobjc.A.dylib                       0x2bc00 objc_exception_throw
2  Foundation                            0x6b6d18 _userInfoForFileAndLine
3  UIKitCore                             0xa2bef8 -[UISoftwareDimmingWindow setOverlayLevel:]
4  UIKitCore                             0xa2fe6c -[UIScreen setBrightness:]
5  CapacitorCommunityScreenBrightness    0x7478 (Missing UUID 5a1b0d8898563665a4768512ae8164cc)
6  CapacitorCommunityScreenBrightness    0x696c (Missing UUID 5a1b0d8898563665a4768512ae8164cc)
7  libdispatch.dylib                     0x26a8 _dispatch_call_block_and_release
8  libdispatch.dylib                     0x4300 _dispatch_client_callout
9  libdispatch.dylib                     0x12998 _dispatch_main_queue_drain
10 libdispatch.dylib                     0x125b0 _dispatch_main_queue_callback_4CF
11 CoreFoundation                        0x3720c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
12 CoreFoundation                        0x33f18 __CFRunLoopRun

Significantly, this one tells me: 94% In background.

Please let me know if I can provide any additional details to help get this fixed. Thank you!

bounteous-alisWard commented 10 months ago

Hi there. Just adding more details. By a stroke of pure luck, I produced this on Android Pixel 6XL with Android 14. My actions were:

  1. uninstall the app
  2. fresh install the app
  3. drag to home from drawer
  4. launch the app from home screen
  5. app crashed

But it's not every time, and I have tried 10x in a row to reproduce without success.

Device brightness is about 33%. Extra dim disabled. Bluetooth disabled. Internet and Location services on. Network was unthrottled. No instant permissions prompts for this app.

Log txt:

       at com.elylucas.capscreenbrightness.ScreenBrightnessPlugin.lambda$setBrightness$0(ScreenBrightnessPlugin.java:22)
       at com.elylucas.capscreenbrightness.ScreenBrightnessPlugin$$ExternalSyntheticLambda0.run(:8)
       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:8177)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
andrerds commented 9 months ago

Hey! I'm experiencing the same issue on various types of devices and Android versions. Any updates on this?

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'float java.lang.Float.floatValue()' on a null object reference at com.elylucas.capscreenbrightness.ScreenBrightnessPlugin.lambda$setBrightness$0(ScreenBrightnessPlugin.java:22) at com.elylucas.capscreenbrightness.ScreenBrightnessPlugin$$ExternalSyntheticLambda0.run(:8) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

jcesarmobile commented 8 months ago

can you provide a sample app?

jcesarmobile commented 6 months ago

closing due to the lack of reproduction