How to fix "Exception thrown while unbinding, java.lang.IllegalArgumentException: Service not registered: lp@9f7d4ca" exception in Flutter? [duplicate] How to fix "Exception thrown while unbinding, java.lang.IllegalArgumentException: Service not registered: lp@9f7d4ca" exception in Flutter? [duplicate] android android

How to fix "Exception thrown while unbinding, java.lang.IllegalArgumentException: Service not registered: lp@9f7d4ca" exception in Flutter? [duplicate]


The fix for this warning will be rolled out in February!

EDIT 11th Feb: From quick tests, I see that this warning is gone in v. 8.0.0 of Firebase messaging, but the package is still in dev; link to it.

EDIT 13th Jan: Android Studios has a neat option in the output to fold lines. If you want to get rid of the long messages that easily interfere while developing right click on the line and fold it. But tweak it before because certain values change.

From this stack:

W/ConnectionTracker(13852): java.lang.IllegalArgumentException: Service not registered: ls@ed97760W/ConnectionTracker(13852):     at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1562)W/ConnectionTracker(13852):     at android.app.ContextImpl.unbindService(ContextImpl.java:1692)W/ConnectionTracker(13852):     at android.content.ContextWrapper.unbindService(ContextWrapper.java:717)W/ConnectionTracker(13852):     at ci.f(:com.google.android.gms.dynamite_measurementdynamite@204714068@20.47.14 (100700-0):1)...

Change the folded ones to:

java.lang.IllegalArgumentException: Service not registered: at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:at android.app.ContextImpl.unbindService(ContextImpl.java:at android.content.ContextWrapper.unbindService(ContextWrapper.java:f(:com.google.android.gms.dynamite_measurementdynamite@...

And so on. I advice you to keep the original folded message and just add a new one to have a history of what you're changing.enter image description here

I kept the first message from the stack to make sure it's nothing else I'm ignoring. This is how two warnings ended up looking instead of 26 lines of cluttering code.enter image description here

EDIT 16th Dec: The fix for this warning will be rolled out in February. Not sure how/why this thread was marked as closed and fixed because there were multiple cases of workarounds that worked more or less.

The real fix will be to try some of the suggestion and if they fail, just wait.

EDIT 13th Dec: From this Git discussion we have a confirmation that this error doesn't cause any other issues, nor crashes.

The old machine that wasn't throwing errors started doing so after an update.

We just have to wait for the update that will make these warnings go away.

EDIT 8th Dec: Nor Java nor adding the SHAs to my Firebase console helped with anything!

EDIT 4th Dec: Looks like on the machine with issues, I didn't have Java installed. All looks well after multiple builds and wipes. I'll keep an eye out!

Visit Oracle's site to download it! Thanks to Talha's comment about SHA (keytool requires Java)!

EDIT 3rd Dec: I did another Firebase setup and as Timo Bähr pointed out, the docs for Firebase setup were updated. As you can see, firebase-bom was added, but also the option to pick Java or Kotlin.

Double checked my project and:

  1. changed all dependencies to Kotlin (-ktx ending)
  2. wiped all the devices data
  3. removed old unused emulators
  4. cold booted the device (both from Android Studio Virtual device manager)

Now the errors are gone (for now?)!

// Import the Firebase BoMimplementation platform('com.google.firebase:firebase-bom:26.1.0')// When using the BoM, you don't specify versions in Firebase library dependencies// Declare the dependency for the Firebase SDK for Google Analyticsimplementation 'com.google.firebase:firebase-analytics-ktx'// Declare the dependencies for any other desired Firebase products// For example, declare the dependencies for Firebase Authentication and Cloud Firestoreimplementation 'com.google.firebase:firebase-auth-ktx'implementation 'com.google.firebase:firebase-firestore-ktx'

EDIT 26th Nov: Exceptions are back even with previous fix from King.

EDIT 23rd Nov: The errors started appearing again after 1-2 days. Please check King Alawaka's answer which may hold the solution which is the same as this Github reply. Positive feedback is coming from it. :)

Initial response: After updating the Firebase dependencies I got rid of these errors. Here are the versions I'm currently using:

firebase_core: ^0.5.2firebase_database: ^4.3.0firebase_analytics: ^6.2.0firebase_messaging: ^7.0.3firebase_crashlytics: ^0.2.3

This may not help because I saw this git issue where the reported versions are similar to the ones I use.

Other options that failed:

  • implementation 'com.google.android.gms:play-services-basement:17.5.0' to android\app\build.gradle
  • downgrade certain packages only to versions ~1 month old
  • disabling analytics and crashlytics (removed the packages too)
  • switching emulated device
  • whipping all data on those device/s


Add the following to your android\app\build.gradle

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


Latest Firebase documentation saying:

// Add this lineapply plugin: 'com.google.gms.google-services'dependencies {    ...    // Import the Firebase BoM    implementation platform('com.google.firebase:firebase-bom:26.4.0')    // Add the dependency for the Firebase SDK for Google Analytics    // When using the BoM, don't specify versions in Firebase dependencies    implementation 'com.google.firebase:firebase-analytics-ktx'    // Add the dependencies for any other desired Firebase products    // https://firebase.google.com/docs/android/setup#available-libraries}

After adding firebase-analytics-ktx the error disappeared.