我是Android新手,支持API 8及更高版本的项目。它是使用Android支持库版本18.0.0的gradle项目。为了支持使用ActivityCompat.OnRequestPermissionsResultCallback接口,ActivityCompat.shouldShowRequestPermissionRationale()等的新权限模型,我尝试使用最新版本com.android.support:support-v4:23.0.1而不是当前版本com。 android.support:support-v4:18.0.0,但当我更改版本时,我的应用程序崩溃说"不幸的是,已停止"带有与TabHost相关的异常的对话框,该异常在应用程序的一个片段中使用。请帮忙。
E / AndroidRuntime(15040):流程: com.example.publisher.test.adaptiveId,PID:15040 E / AndroidRuntime(15040):java.lang.RuntimeException:无法启动 活动 ComponentInfo {com.example.publisher.test.adaptiveId / com.example.sdk.test.MainActivity}: java.lang.NullPointerException:尝试调用虚方法' void android.widget.TabHost.setup()'在null对象引用上 E / AndroidRuntime(15040):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) E / AndroidRuntime(15040):at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) E / AndroidRuntime(15040):at android.app.ActivityThread.-wrap11(ActivityThread.java) E / AndroidRuntime(15040):at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1344) E / AndroidRuntime(15040):at android.os.Handler.dispatchMessage(Handler.java:102) E / AndroidRuntime(15040):在android.os.Looper.loop(Looper.java:148) E / AndroidRuntime(15040):at android.app.ActivityThread.main(ActivityThread.java:5417) E / AndroidRuntime(15040):at java.lang.reflect.Method.invoke(Native 方法)E / AndroidRuntime(15040):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:726) E / AndroidRuntime(15040):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) E / AndroidRuntime(15040):引起:java.lang.NullPointerException: 尝试调用虚方法' void android.widget.TabHost.setup()' 在null对象引用E / AndroidRuntime(15040):at com.example.sdk.test.MainActivity.setupTabs(MainActivity.java:166) E / AndroidRuntime(15040):at com.example.sdk.test.TabsFragment.onActivityCreated(TabsFragment.java:47) E / AndroidRuntime(15040):at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1970) E / AndroidRuntime(15040):at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1051) E / AndroidRuntime(15040):at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1207) E / AndroidRuntime(15040):at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1189) E / AndroidRuntime(15040):at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2001) E / AndroidRuntime(15040):at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:165) E / AndroidRuntime(15040):at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:507) E / AndroidRuntime(15040):at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237) E / AndroidRuntime(15040):at android.app.Activity.performStart(Activity.java:6253) E / AndroidRuntime(15040):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379) E / AndroidRuntime(15040):... 9更多