abh80 / smart-edge

Alternative to dynamic island for android.
https://f-droid.org/packages/com.abh80.smartedge/
MIT License
205 stars 28 forks source link

Unexpected crashing on POCO devices on first startup #16

Closed dghqz closed 1 year ago

dghqz commented 1 year ago

After installing the latest releases (v2.1-alpha3 and alpha4) the app crashes on startup on a POCO X3 Pro using stock ROM, however using the first release (v2.1-alpha1) it works perfectly fine.

Here's a copy of the crash logs:

(v2.1-alpha3)

java.lang.RuntimeException: Unable to create service com.abh80.smartedge.services.UpdaterService: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference at android.app.ActivityThread.handleCreateService(ActivityThread.java:4648) at android.app.ActivityThread.access$1800(ActivityThread.java:276) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2149) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8261) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference at android.content.ContextWrapper.getPackageName(ContextWrapper.java:162) at com.abh80.smartedge.services.UpdaterService.<init>(UpdaterService.java:117) at java.lang.Class.newInstance(Native Method) at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:129) at androidx.core.app.CoreComponentFactory.instantiateService(CoreComponentFactory.java:75) at android.app.ActivityThread.handleCreateService(ActivityThread.java:4617) ... 9 more

(v2.1-alpha4)

java.lang.RuntimeException: Unable to create service com.abh80.smartedge.services.UpdaterService: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference at android.app.ActivityThread.handleCreateService(ActivityThread.java:4648) at android.app.ActivityThread.access$1800(ActivityThread.java:276) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2149) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8261) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference at android.content.ContextWrapper.getPackageName(ContextWrapper.java:162) at com.abh80.smartedge.services.UpdaterService.<init>(UpdaterService.java:117) at java.lang.Class.newInstance(Native Method) at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:129) at androidx.core.app.CoreComponentFactory.instantiateService(CoreComponentFactory.java:75) at android.app.ActivityThread.handleCreateService(ActivityThread.java:4617) ... 9 more

I checked both crash logs and they both look the same in both instances, even I tried to grant all the necessary permissions to both versions of the app without success, as mentioned before only version 2.1-alpha1 seems to work on my device.

abh80 commented 1 year ago

I tried testing on android avd and on my device galaxy s20, it worked well on both, I am looking into your matter. I will try fixing as soon as I can

abh80 commented 1 year ago

Looking upon the logs both are same also according to the log it points to 117 line which does not have the getPackage line which caused the error but it had on 4.1-alpha3. Can you please do a fresh reinstall of the alpha4 and let me know

https://github.com/abh80/smart-edge/blob/master/app/src/main/java/com/abh80/smartedge/services/UpdaterService.java#L117

dghqz commented 1 year ago

Looking upon the logs both are same also according to the log it points to 117 line which does not have the getPackage line which caused the error but it had on 4.1-alpha3. Can you please do a fresh reinstall of the alpha4 and let me know

https://github.com/abh80/smart-edge/blob/master/app/src/main/java/com/abh80/smartedge/services/UpdaterService.java#L117

Did a clean install of the alpha4 version and seems like it's working without issues, also tried to apply the alpha5 update on top of that and it's working with no issues whatsoever.

abh80 commented 1 year ago

Looks good thanks