Flutter-geolocator: java.lang.IllegalArgumentException: Service not registered

Created on 2 Sep 2020  ·  25Comments  ·  Source: Baseflow/flutter-geolocator

🔙 Regression

After upgrading to 6.0.0+1 I started to receive an exception as a warning on console multiple times

Old (and correct) behavior

Not having an exception

Reproduction steps

Just ask the position and the error appears after a while

Configuration

Version: 6.0.0+1

Platform:

  • [ ] :iphone: iOS
  • [X] :robot: Android

Console output

W/ConnectionTracker( 1662): Exception thrown while unbinding
W/ConnectionTracker( 1662): java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.measurement.internal.zzjf@5516abb
W/ConnectionTracker( 1662):     at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1870)
W/ConnectionTracker( 1662):     at android.app.ContextImpl.unbindService(ContextImpl.java:1847)
W/ConnectionTracker( 1662):     at android.content.ContextWrapper.unbindService(ContextWrapper.java:755)
W/ConnectionTracker( 1662):     at com.google.android.gms.common.stats.ConnectionTracker.zza(com.google.android.gms:play-services-basement@@17.3.0:55)
W/ConnectionTracker( 1662):     at com.google.android.gms.common.stats.ConnectionTracker.unbindService(com.google.android.gms:play-services-basement@@17.3.0:50)
W/ConnectionTracker( 1662):     at com.google.android.gms.measurement.internal.zzin.zzah(com.google.android.gms:play-services-measurement-impl@@17.4.1:246)
W/ConnectionTracker( 1662):     at com.google.android.gms.measurement.internal.zzin.zzam(com.google.android.gms:play-services-measurement-impl@@17.4.1:263)
W/ConnectionTracker( 1662):     at com.google.android.gms.measurement.internal.zzin.zzc(com.google.android.gms:play-services-measurement-impl@@17.4.1:330)
W/ConnectionTracker( 1662):     at com.google.android.gms.measurement.internal.zziq.zza(com.google.android.gms:play-services-measurement-impl@@17.4.1:2)
W/ConnectionTracker( 1662):     at com.google.android.gms.measurement.internal.zzah.run(com.google.android.gms:play-services-measurement-impl@@17.4.1:7)
W/ConnectionTracker( 1662):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
W/ConnectionTracker( 1662):     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/ConnectionTracker( 1662):     at com.google.android.gms.measurement.internal.zzfy.run(com.google.android.gms:play-services-measurement-impl@@17.4.1:21)
android in progress bug

Most helpful comment

Add the following to your android\appbuild.gradle

implementation 'com.google.android.gms:play-services-basement:17.5.0'
implementation 'com.google.firebase:firebase-analytics:18.0.0'

All 25 comments

@inceptusp this seems like an issue with the Google Play Services. Do you have Google Play Services installed on your device?

Did you use the forceAndroidLocationManager property with the previous versions of the Geolocator plugin? If so you can now pass this as a parameter to the getCurrentPosition and getPositionStream methods. This will force Android to use the legacy LocationManager instead of the FusedLocationProviderClient (which requires Google Play Services).

@mvanbeusekom Yes, I have Google Play Services... It is a Samsung Galaxy J6, the same device I was using before the update... I never used the forceAndroidLocationManager property... By the way, before the update, I was even using that methods to perform Geocoding and Reverse Geocoding, which is now under a diferent plugin and requires Play Services too, and they seem to be working fine...

@mvanbeusekom @inceptusp

FYI. I have also been seeing this error after I upgraded to 6.0.0+1. When I revert to 5.3.2+2 it goes away again. I have moved my geocoding calls to geocoding 1.0.3 and that is working fine. The issue is definitely with geolocator 6.0.0+1. I also don't use forceAndroidLocationManager and I use Play Services. Been trying to use the debugger to narrow the issue down to a particular call before I reported it but struggling. It only appears after I load my home page and appears to have a delay so could be a listener or an async await call.

I also saw this recently, correct me if I'm wrong but com.google.android.gms.measurement.internal came from Firebase Analytics API. Maybe the firebase plugin and geolocator are communicating in some ways. Also saw this issue on the Firebase Core plugin.

@GrahamDi @inceptusp it looks like it is related to this issue and I noticed that we indeed bring in the com.google.android.gms:play-services-base:17.3.0 as part of the geolocator build.gradle file.

This should be fixed by removing the line, but I need to test this out. I will do so today / tomorrow and then make a new release.

Hi @inceptusp and @GrahamDi, I have just release version 6.0.0+2 of the geolocator plugin where I removed the com.google.android.gms:play-services-base:17.3.0 line from the geolocator's build.gradle file. Is it possible for one of you to test if this solved the problem? I would really appreciate that.

Hi,

I can only test tomorrow unfortunately, but will certainly do so.

Hopefully @inceptusp https://github.com/inceptusp can test sooner.

Krgrds, Graham

On Thu, 03 Sep 2020, 15:57 Maurits van Beusekom, notifications@github.com
wrote:

Hi @inceptusp https://github.com/inceptusp and @GrahamDi
https://github.com/GrahamDi, I have just release version 6.0.0+2 of the
geolocator plugin where I removed the
com.google.android.gms:play-services-base:17.3.0 line from the
geolocator's build.gradle file. Is it possible for one of you to test if
this solved the problem? I would really appreciate that.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Baseflow/flutter-geolocator/issues/503#issuecomment-686510221,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AHVES4AF3HVK3GMAMQ5DBCTSD6OEFANCNFSM4QSOIRBA
.

@mvanbeusekom I have just tested and it is working flawlessly now... Thx

Glad to hear! Thanks for the feedback and posting the bug report!

Will close the issue, if the error pops up again let me know and I’ll reopen it again

@mvanbeusekom Finally got around to testing it. Working fine for me also. Thanks a lot for fixing so quickly.

Add the following to your android\appbuild.gradle

implementation 'com.google.android.gms:play-services-basement:17.5.0'
implementation 'com.google.firebase:firebase-analytics:18.0.0'

Glad to hear! Thanks for the feedback and posting the bug report!

Will close the issue, if the error pops up again let me know and I’ll reopen it again

I still have the same issue.

pubspec.yaml file
cupertino_icons: ^1.0.1
firebase_core: ^0.5.3
firebase_auth: ^0.18.4+1
firebase_database: ^4.4.0

Project level build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.4'
}

App level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

dependencies {
implementation platform('com.google.firebase:firebase-bom:26.1.1')
}

The error occurs after adding this line to App level build.gradle file
apply plugin: 'com.google.gms.google-services'

@amroomi not sure I can help here, your listing of the pubspec.yaml doesn't mention you are using the "geolocator" plugin.

Looks like this has to do something with the other "firebase" plugins, this issue is still open for those plugins: https://github.com/firebase/firebase-android-sdk/issues/1662

@mvanbeusekom I am not using geolocator plugin I am only using firebase core, auth and database plugins.

Yes but you are raising this issue in the geolocator repository. We maintain the geolocator and have no relation to the firebase plugins.

Same me

W/ConnectionTracker: Exception thrown while unbinding
java.lang.IllegalArgumentException: Service not registered: lu@c38f59c
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1671)
at android.app.ContextImpl.unbindService(ContextImpl.java:1781)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:730)
at ci.f(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):1)
at ci.d(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):2)
at lv.E(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):9)
at lf.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):3)
at ef.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):3)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:459)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at iy.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):5)

Same me

W/ConnectionTracker: Exception thrown while unbinding
java.lang.IllegalArgumentException: Service not registered: lu@c38f59c
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1671)
at android.app.ContextImpl.unbindService(ContextImpl.java:1781)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:730)
at ci.f(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):1)
at ci.d(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):2)
at lv.E(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):9)
at lf.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):3)
at ef.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):3)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:459)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at iy.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (100400-0):5)

I have now the same error, didn't touch my code and it was working 2 days ago...

@sontn15, @sebastien-michel, just to make sure are you both using the geolocator plugin?

Do you depend on any other packages (i.e. firebase)?

Could you provide some additional information? Mostly the contents of the pubspec.yaml, build.gradle and the output of the flutter doctor -v command.

@amroomi @sontn15 @sebastien-michel this error is a bug on firebase_core tracked by this issue: https://github.com/FirebaseExtended/flutterfire/issues/4090

It was a bug on Geolocator but @mvanbeusekom has fixed it... You should complain with flutterfire team... I am too receiving this same messages using firebase_admob since it requires firebase_core which is the cause of the issue...

The same problem while login in firebase with Facebook

W/ConnectionTracker(26498): Exception thrown while unbinding
W/ConnectionTracker(26498): java.lang.IllegalArgumentException: Service not registered: ls@76dcf29
W/ConnectionTracker(26498):     at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1759)
W/ConnectionTracker(26498):     at android.app.ContextImpl.unbindService(ContextImpl.java:1786)
W/ConnectionTracker(26498):     at android.content.ContextWrapper.unbindService(ContextWrapper.java:751)

Same problem

W/ConnectionTracker( 4736): Exception thrown while unbinding
W/ConnectionTracker( 4736): java.lang.IllegalArgumentException: Service not registered: ls@c33423gd
W/ConnectionTracker( 4736):     at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1757)
W/ConnectionTracker( 4736):     at android.app.ContextImpl.unbindService(ContextImpl.java:1874)
W/ConnectionTracker( 4736):     at android.content.ContextWrapper.unbindService(ContextWrapper.java:792)
W/ConnectionTracker( 4736):     at ci.f(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150700-0):1)
W/ConnectionTracker( 4736):     at ci.d(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150700-0):2)
W/ConnectionTracker( 4736):     at lt.E(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150700-0):9)
W/ConnectionTracker( 4736):     at ld.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150700-0):3)
W/ConnectionTracker( 4736):     at ef.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150700-0):3)
W/ConnectionTracker( 4736):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
W/ConnectionTracker( 4736):     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/ConnectionTracker( 4736):     at iy.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] (150700-0):5)

Same problem with atttempt show admob test ad

@Nasar-uddin, @dulkith, @vsalamov, really curious why you are posting these problems here? How does this related to the geolocator plugin?

Please provide information on why you think this problem has to do with the geolocator plugin (since we solved this issue months ago). If you are having this issue and do not make use of the geolocotor plugin, the answer is: you are in the wrong place, please post this issue in the correct location (if you are experiencing this problem in combination with Firebase, read through issue FirebaseExtended/flutterfire#4090, they document workarounds (for example here).

@mvanbeusekom I think you should lock this thread for now... They are posting these things here because when you search the error on Google it leave them here...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BhaveshPrince picture BhaveshPrince  ·  15Comments

humazed picture humazed  ·  37Comments

fbambusi picture fbambusi  ·  28Comments

brenoasm picture brenoasm  ·  63Comments

razmik-gharibyan picture razmik-gharibyan  ·  20Comments