如何修复“解除绑定时抛出异常,java.lang.IllegalArgumentException:服务未注册:lp@9f7d4ca"Flutter 中的异常? [英] How to fix "Exception thrown while unbinding, java.lang.IllegalArgumentException: Service not registered: lp@9f7d4ca" exception in Flutter?

查看:30
本文介绍了如何修复“解除绑定时抛出异常,java.lang.IllegalArgumentException:服务未注册:lp@9f7d4ca"Flutter 中的异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的调试控制台向我展示了这个:

W/ConnectionTracker(17934):解除绑定时抛出异常W/ConnectionTracker(17934):java.lang.IllegalArgumentException:服务未注册:lp@9f7d4caW/ConnectionTracker(17934):在 android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1557)W/ConnectionTracker(17934):在 android.app.ContextImpl.unbindService(ContextImpl.java:1692)W/ConnectionTracker(17934):在 android.content.ContextWrapper.unbindService(ContextWrapper.java:717)W/ConnectionTracker(17934):在 ci.f(:com.google.android.gms.dynamite_measurementdynamite@204215067@20.42.15 (100408-​​0):1)W/ConnectionTracker(17934):在 ci.d(:com.google.android.gms.dynamite_measurementdynamite@204215067@20.42.15 (100408-​​0):2)W/ConnectionTracker(17934): at lq.D(:com.google.android.gms.dynamite_measurementdynamite@204215067@20.42.15 (100408-​​0):10)W/ConnectionTracker(17934):在 lc.a(:com.google.android.gms.dynamite_measurementdynamite@204215067@20.42.15 (100408-​​0):2)

我不知道该怎么做.

解决方案

我保留了堆栈中的第一条消息,以确保它没有被我忽略.这就是两个警告最终看起来的方式,而不是 26 行杂乱的代码.

编辑 12 月 16 日:此警告的修复程序将于 2 月推出.不确定如何/为什么将此线程标记为已关闭和已修复,因为有多种变通方法或多或少有效.

真正的解决方法是尝试一些建议,如果失败,请等待.

编辑 12 月 13 日:从此Git 讨论 我们确认此错误不会导致任何其他问题,也不会导致崩溃.

没有抛出错误的旧机器在更新后开始这样做.

我们只需要等待将使这些警告消失的更新.

编辑 12 月 8 日:Java 或将 SHA 添加到我的 Firebase 控制台都没有帮助!

编辑 12 月 4 日:看起来在有问题的机器上,我没有安装 Java.经过多次构建和擦拭后,一切看起来都很好.我会注意的!

访问 Oracle 网站 下载!感谢 Talha 对 SHA 的评论(keytool 需要 Java)!

编辑 12 月 3 日:我做了另一个 Firebase 设置,正如 Timo Bähr 指出的那样,Firebase 设置文档 已更新.如您所见,添加了 firebase-bom,但还提供了选择 Java 或 Kotlin 的选项.

仔细检查了我的项目并:

  1. 将所有依赖项更改为 Kotlin(-ktx 结尾)
  2. 擦除所有设备数据
  3. 删除旧的未使用的模拟器
  4. 冷启动设备(均来自 Android Studio 虚拟设备管理器)

现在错误消失了(现在?)!

//导入 Firebase BoM实现平台('com.google.firebase:firebase-bom:26.1.0')//使用 BoM 时,不要在 Firebase 库依赖项中指定版本//声明 Firebase SDK for Google Analytics 的依赖项实施 'com.google.firebase:firebase-analytics-ktx'//声明任何其他所需 Firebase 产品的依赖项//例如,声明 Firebase Authentication 和 Cloud Firestore 的依赖项实施 'com.google.firebase:firebase-auth-ktx'实现 'com.google.firebase:firebase-firestore-ktx'

编辑 11 月 26 日:即使使用 King 之前的修复,例外情况又回来了.

编辑 11 月 23 日:错误在 1-2 天后再次出现.请检查 King Alawaka 的答案,该答案可能包含与 这个 Github 回复.积极的反馈来自它.:)

初始响应:更新 Firebase 依赖项后,我摆脱了这些错误.以下是我目前使用的版本:

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

这可能没有帮助,因为我看到了这个git问题 其中报告的版本与我使用的版本相似.

其他失败的选项:

  • 实现 'com.google.android.gms:play-services-basement:17.5.0'androidappuild.gradle
  • 仅将某些软件包降级到大约 1 个月大的版本
  • 禁用分析和 crashlytics(也删除了包)
  • 切换模拟设备
  • 鞭打这些设备上的所有数据

My debug console show me this:

W/ConnectionTracker(17934): Exception thrown while unbinding
W/ConnectionTracker(17934): java.lang.IllegalArgumentException: Service not registered: lp@9f7d4ca
W/ConnectionTracker(17934):     at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1557)
W/ConnectionTracker(17934):     at android.app.ContextImpl.unbindService(ContextImpl.java:1692)
W/ConnectionTracker(17934):     at android.content.ContextWrapper.unbindService(ContextWrapper.java:717)
W/ConnectionTracker(17934):     at ci.f(:com.google.android.gms.dynamite_measurementdynamite@204215067@20.42.15 (100408-0):1)
W/ConnectionTracker(17934):     at ci.d(:com.google.android.gms.dynamite_measurementdynamite@204215067@20.42.15 (100408-0):2)
W/ConnectionTracker(17934):     at lq.D(:com.google.android.gms.dynamite_measurementdynamite@204215067@20.42.15 (100408-0):10)
W/ConnectionTracker(17934):     at lc.a(:com.google.android.gms.dynamite_measurementdynamite@204215067@20.42.15 (100408-0):2)

I dont know how do i do it.

解决方案

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@ed97760
W/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.

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.

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 BoM
implementation 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 Analytics
implementation '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 Firestore
implementation '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.2
firebase_database: ^4.3.0
firebase_analytics: ^6.2.0
firebase_messaging: ^7.0.3
firebase_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 androidappuild.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

这篇关于如何修复“解除绑定时抛出异常,java.lang.IllegalArgumentException:服务未注册:lp@9f7d4ca"Flutter 中的异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆