java.lang.IllegalArgumentException: Service not registered 参数异常:服务未注册

4

我有一个包含 WebView 的应用程序。一切都运行良好,但在 Android Studio 的运行选项卡中,我收到以下消息。我的应用程序仍在正常工作,但这个消息让我感到烦恼。我不太了解这个消息的含义。

Exception thrown while unbinding
    java.lang.IllegalArgumentException: Service not registered: lx@643d3c7
        at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1526)
        at android.app.ContextImpl.unbindService(ContextImpl.java:1717)
        at android.content.ContextWrapper.unbindService(ContextWrapper.java:722)
        at ci.b(:com.google.android.gms.dynamite_measurementdynamite@203615046@20.36.15 (040306-0):1)
        at ci.a(:com.google.android.gms.dynamite_measurementdynamite@203615046@20.36.15 (040306-0):6)
        at ly.A(:com.google.android.gms.dynamite_measurementdynamite@203615046@20.36.15 (040306-0):10)
        at li.a(:com.google.android.gms.dynamite_measurementdynamite@203615046@20.36.15 (040306-0):3)
        at ec.run(:com.google.android.gms.dynamite_measurementdynamite@203615046@20.36.15 (040306-0):3)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at jb.run(:com.google.android.gms.dynamite_measurementdynamite@203615046@20.36.15 (040306-0):6)

我查了谷歌,发现我需要在清单文件中声明服务。

来源 https://dev59.com/5WvXa4cB1Zd3GeqPH1T6#13600695

但我不知道我需要声明哪个服务。

更新

这篇文章与我的问题类似

Android前台服务始终抛出“java.lang.IllegalArgumentException:Service not registered”异常

被接受的答案很好

https://dev59.com/qbvoa4cB1Zd3GeqP3m-p#62220764

我也使用了

 implementation 'com.google.android.gms:play-services-ads:19.3.0'

我猜这个依赖关系导致了那个消息。但是即使它不影响应用程序,是否有任何方法可以删除该消息呢?

依赖关系

implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.google.android.gms:play-services-ads:19.3.0'

你使用了继承至 Service 的类..你需要在 manifest 中声明这个类。 - Wini
抱歉,但我不认为我有故意使用任何服务。或者有任何扩展任何服务的类。有没有办法知道应用程序中正在使用哪个服务。我不了解服务概念。 - Sahil Goyal
你是否正在使用Play Services库? - Wini
是的,@Wini,我刚刚更新了我的问题。 - Sahil Goyal
你能把你的依赖项加在这里吗?你在你的依赖项中包含了什么? - Wini
显示剩余2条评论
1个回答

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接