我有一个包含 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@[email protected] /cdn-cgi/l/email-protection (040306-0):1)
at ci.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] /cdn-cgi/l/email-protection (040306-0):6)
at ly.A(:com.google.android.gms.dynamite_measurementdynamite@[email protected] /cdn-cgi/l/email-protection (040306-0):10)
at li.a(:com.google.android.gms.dynamite_measurementdynamite@[email protected] /cdn-cgi/l/email-protection (040306-0):3)
at ec.run(:com.google.android.gms.dynamite_measurementdynamite@[email protected] /cdn-cgi/l/email-protection (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@[email protected] /cdn-cgi/l/email-protection (040306-0):6)
我搜索了谷歌,发现我必须在清单文件中声明服务。
Source https://stackoverflow.com/a/13600695/13485181 https://stackoverflow.com/a/13600695/13485181
但我不知道我必须在清单中声明哪些服务。
UPDATE
这个帖子和我的很相似
Android 前台服务始终抛出“java.lang.IllegalArgumentException:服务未注册”异常 https://stackoverflow.com/q/62217275/13485181
接受的答案很好
https://stackoverflow.com/a/62220764/13485181 https://stackoverflow.com/a/62220764/13485181
我也用
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'