zhaokai621
zhaokai621
采纳率0%
2018-12-18 17:40 阅读 560

Android 8.0报错,6.0上没问题,哪位晓得啊

5

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.androidvideo/com.example.androidvideo.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'int android.view.IWindowManager.getStatusBarColorFromAdaptation(java.lang.String, java.lang.String)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3000)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3078)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7014)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:514)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int android.view.IWindowManager.getStatusBarColorFromAdaptation(java.lang.String, java.lang.String)' on a null object reference
at com.android.internal.policy.PhoneWindow.getStatusBarColorFromAdaptation(PhoneWindow.java:4261)
at com.android.internal.policy.PhoneWindow.setWindowManager(PhoneWindow.java:376)
at android.app.Activity.attach(Activity.java:7223)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2933)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3078) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:183) 
at android.app.ActivityThread.main(ActivityThread.java:7014) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:514) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888) 


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • dsxjinzhiqiang dsxjinzhiqiang 2018-12-19 02:53

    说的是没有启动activity,在空对象 IWindowManager.getStatusBarColorFromAdaptation上引用方法失败,说明这个对象不存在,8.0和6.0获取对象的方法不一样,你可以试试这方面的。

    点赞 评论 复制链接分享
  • nuanchenmi nuanchenmi 2018-12-19 11:44

    像这种错误,很有可能是因为IWindowManager.getStatusBarColorFromAdaptation(java.lang.String, java.lang.String)这个接口的对象没有进行实例化(new)

    点赞 评论 复制链接分享

相关推荐