错误代码:
Activity com.runou.app.ltem.WebPageModule has leaked ServiceConnection com.baidu.location.LocationClient$1@8c9b71e that was originally bound here
android.app.ServiceConnectionLeaked: Activity com.runou.app.ltem.WebPageModule has leaked ServiceConnection com.baidu.location.LocationClient$1@8c9b71e that was originally bound here
at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1790)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1682)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1888)
at android.app.ContextImpl.bindService(ContextImpl.java:1841)
at android.content.ContextWrapper.bindService(ContextWrapper.java:698)
at com.baidu.location.LocationClient.a(Unknown Source:110)
at com.baidu.location.LocationClient.o(Unknown Source:0)
at com.baidu.location.LocationClient$a.handleMessage(Unknown Source:43)
at android.os.Handler.dispatchMessage(Handler.java:109)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:7539)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
2019
解决方案:
方法:
添加定位权限:
<uses-permission android:name="android.permission.BAIDU_LOCATION_SERVICE" />
再 manifest 文件 中 application 之间添加下面service标签。
<service
android:name="com.baidu.location.f"
android:enabled="true"
android:process=":remote" >
</service>
感谢:https://blog.csdn.net/m0_37039192/article/details/80590304