我正在为我的项目使用从 github 获得的选项卡主机,它最近坏了。这只发生在我加载包含我的谷歌地图的选项卡并且适用于所有其他选项卡时。我收到错误 IllegalArgumentException:调用时连接为空
// Bind the location service
Intent testIntent = new Intent(this, wd_locationService.class);
bindService(testIntent, myConnection, Context.BIND_AUTO_CREATE);
这是堆栈跟踪:
08-21 17:25:48.524: E/AndroidRuntime(20354): FATAL EXCEPTION: main
08-21 17:25:48.524: E/AndroidRuntime(20354): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.backtrailtech.hunterelite/com.backtrailtech.hunterelite.wd_mapView}: java.lang.IllegalArgumentException: connection is null
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2023)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
08-21 17:25:48.524: E/AndroidRuntime(20354): at com.backtrailtech.hunterelite.ScrollableTabActivity.startGroupActivity(ScrollableTabActivity.java:288)
08-21 17:25:48.524: E/AndroidRuntime(20354): at com.backtrailtech.hunterelite.ScrollableTabActivity.onCheckedChanged(ScrollableTabActivity.java:272)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.widget.RadioGroup.setCheckedId(RadioGroup.java:174)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.widget.RadioGroup.access$600(RadioGroup.java:54)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.widget.RadioGroup$CheckedStateTracker.onCheckedChanged(RadioGroup.java:358)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.widget.CompoundButton.setChecked(CompoundButton.java:129)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.widget.CompoundButton.toggle(CompoundButton.java:87)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.widget.RadioButton.toggle(RadioButton.java:76)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.widget.CompoundButton.performClick(CompoundButton.java:99)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.view.View$PerformClick.run(View.java:17355)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.os.Handler.handleCallback(Handler.java:725)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.os.Handler.dispatchMessage(Handler.java:92)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.os.Looper.loop(Looper.java:137)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-21 17:25:48.524: E/AndroidRuntime(20354): at java.lang.reflect.Method.invokeNative(Native Method)
08-21 17:25:48.524: E/AndroidRuntime(20354): at java.lang.reflect.Method.invoke(Method.java:511)
08-21 17:25:48.524: E/AndroidRuntime(20354): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-21 17:25:48.524: E/AndroidRuntime(20354): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-21 17:25:48.524: E/AndroidRuntime(20354): at dalvik.system.NativeStart.main(Native Method)
08-21 17:25:48.524: E/AndroidRuntime(20354): Caused by: java.lang.IllegalArgumentException: connection is null
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.app.ContextImpl.bindService(ContextImpl.java:1415)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
08-21 17:25:48.524: E/AndroidRuntime(20354): at com.backtrailtech.hunterelite.wd_mapView.onCreate(wd_mapView.java:1007)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.app.Activity.performCreate(Activity.java:5104)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
08-21 17:25:48.524: E/AndroidRuntime(20354): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
08-21 17:25:48.524: E/AndroidRuntime(20354): ... 22 more
另外,到目前为止,我只在我的 Galaxy Nexus 4.2.2 上看到了这个问题,而我没有在模拟器上看到这个问题。谢谢。