Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to invoke virtual method 'wd.a io.flutter.embedding.engine.a.j()' on a null object reference #129

Open
OsamaQureshi796 opened this issue Aug 21, 2024 · 4 comments

Comments

@OsamaQureshi796
Copy link

Dear @X-SLAYER

I'm using flutter_overlay_window latest version.

Unfortunately i'm getting lots of fatal exceptions in firebase crashlytics regarding flutter_overlay_window.

Bellow is the crash report from firebase crashlytics.

Fatal Exception: java.lang.RuntimeException: Unable to create service flutter.overlay.window.flutter_overlay_window.OverlayService: java.lang.NullPointerException: Attempt to invoke virtual method 'wd.a io.flutter.embedding.engine.a.j()' on a null object reference
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:4627)
       at android.app.ActivityThread.access$1600(ActivityThread.java:301)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2175)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8550)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'wd.a io.flutter.embedding.engine.a.j()' on a null object reference
       at flutter.overlay.window.flutter_overlay_window.OverlayService.<init>(:35)
       at java.lang.Class.newInstance(Class.java)
       at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:129)
       at androidx.core.app.CoreComponentFactory.instantiateService()
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:4606)
       at android.app.ActivityThread.access$1600(ActivityThread.java:301)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2175)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8550)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Could you please take some of your time look into this issue.

Thanks

@PedroAlvim
Copy link

I'm having the same problem as you, for me the flow that happens is that when the application dies in a few moments the overlay disappears, but the overlay service still exists for a short period of time. If the user opens the application in this period, the application crashes

@OsamaQureshi796
Copy link
Author

Hi @PedroAlvim ,

Yes it happens with me as well, if i remove app from the recent apps and bubble is active so after some time it'll shows that app is keeps stopping.

WhatsApp Image 2024-08-22 at 5 37 15 PM

@PedroAlvim
Copy link

Hi @OsamaQureshi796,

In my case, finding the cause in OverlayService, and fixed it there, what changed was that the flutterChannel and overlayMessageChannel variables no longer have initiators, and just before using them in onStartCommand, I check if it is null and fill it in if necessary.

I'll try to make a pull request later with this fix, I don't know if it's the best way, but it definitely solved my problem.

@taghassan54
Copy link

Hi @PedroAlvim i have tried to use your repo instead of X-SLAYER but same issue appear even while i'm using yours
any Suggestions it's happen only in release and when app is fully closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants