百度导航的坑Caused by: android.content.res.Resources$NotFoundException: Resource ID

最近做一个AR导航,集成了百度AR导航,上来就报这个错

2019-05-30 16:45:16.911 31954-31954/com.icbc.elife D/yanjin: WalkNavi engineInitSuccess
2019-05-30 16:45:16.914 31954-31954/com.icbc.elife D/yanjin: WalkNavi onRoutePlanStart
2019-05-30 16:45:17.556 31954-31954/com.icbc.elife W/ResourceType: For resource 0x7f020194, entry index(404) is beyond type entryCount(343)
2019-05-30 16:45:17.556 31954-31954/com.icbc.elife W/ResourceType: Failure getting entry for 0x7f020194 (t=1 e=404) (error -75)
2019-05-30 16:45:17.556 31954-31954/com.icbc.elife W/System.err: android.view.InflateException: Binary XML file line #592: Binary XML file line #592: Error inflating class CheckBox
2019-05-30 16:45:17.556 31954-31954/com.icbc.elife W/System.err: Caused by: android.view.InflateException: Binary XML file line #592: Error inflating class CheckBox
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err: Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f020194
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err:     at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:216)
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err:     at android.content.res.Resources.getValue(Resources.java:1330)
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatDrawableManager.createDrawableIfNeeded(AppCompatDrawableManager.java:235)
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:102)
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatCompoundButtonHelper.loadFromAttributes(AppCompatCompoundButtonHelper.java:64)
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatCheckBox.(AppCompatCheckBox.java:65)
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatCheckBox.(AppCompatCheckBox.java:59)
2019-05-30 16:45:17.562 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.app.AppCompatViewInflater.createCheckBox(AppCompatViewInflater.java:207)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:126)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at com.baidu.platform.comapi.wnplatform.p.a.a.a(ResUtils.java:168)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at com.baidu.platform.comapi.walknavi.g.a.(WalkUIController.java:351)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at com.baidu.platform.comapi.walknavi.b.b(WNavigator.java:585)
2019-05-30 16:45:17.563 31954-31954/com.icbc.elife W/System.err:     at com.baidu.mapapi.walknavi.controllers.a.a.a(WalkNaviManager.java:189)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at com.baidu.mapapi.walknavi.WalkNavigateHelper.onCreate(WalkNavigateHelper.java:339)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at com.easy.sightp.easyar30.view.activity.TestActivity.onCreate(TestActivity.java:51)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at android.app.Activity.performCreate(Activity.java:7183)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.-wrap11(Unknown Source:0)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:105)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at android.os.Looper.loop(Looper.java:164)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6938)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
2019-05-30 16:45:17.564 31954-31954/com.icbc.elife W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at com.baidu.platform.comapi.walknavi.g.a.G(WalkUIController.java:849)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at com.baidu.platform.comapi.walknavi.g.a.H(WalkUIController.java:869)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at com.baidu.platform.comapi.walknavi.g.a.(WalkUIController.java:352)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at com.baidu.platform.comapi.walknavi.b.b(WNavigator.java:585)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at com.baidu.mapapi.walknavi.controllers.a.a.a(WalkNaviManager.java:189)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at com.baidu.mapapi.walknavi.WalkNavigateHelper.onCreate(WalkNavigateHelper.java:339)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at com.easy.sightp.easyar30.view.activity.TestActivity.onCreate(TestActivity.java:51)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at android.app.Activity.performCreate(Activity.java:7183)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.-wrap11(Unknown Source:0)
2019-05-30 16:45:17.565 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
2019-05-30 16:45:17.566 31954-31954/com.icbc.elife W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:105)
2019-05-30 16:45:17.566 31954-31954/com.icbc.elife W/System.err:     at android.os.Looper.loop(Looper.java:164)
2019-05-30 16:45:17.566 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6938)
2019-05-30 16:45:17.566 31954-31954/com.icbc.elife W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-05-30 16:45:17.566 31954-31954/com.icbc.elife W/System.err:     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
2019-05-30 16:45:17.566 31954-31954/com.icbc.elife W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
2019-05-30 16:45:17.568 31954-31961/com.icbc.elife I/zygote: Compiler allocated 5MB to compile void android.widget.TextView.(android.content.Context, android.util.AttributeSet, int, int)
2019-05-30 16:45:17.605 31954-31954/com.icbc.elife W/ResourceType: For resource 0x7f020194, entry index(404) is beyond type entryCount(343)
2019-05-30 16:45:17.605 31954-31954/com.icbc.elife W/ResourceType: Failure getting entry for 0x7f020194 (t=1 e=404) (error -75)
2019-05-30 16:45:17.605 31954-31954/com.icbc.elife W/System.err: android.view.InflateException: Binary XML file line #592: Binary XML file line #592: Error inflating class CheckBox
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err: Caused by: android.view.InflateException: Binary XML file line #592: Error inflating class CheckBox
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err: Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f020194
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:216)
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.content.res.Resources.getValue(Resources.java:1330)
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatDrawableManager.createDrawableIfNeeded(AppCompatDrawableManager.java:235)
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:102)
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatCompoundButtonHelper.loadFromAttributes(AppCompatCompoundButtonHelper.java:64)
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatCheckBox.(AppCompatCheckBox.java:65)
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.widget.AppCompatCheckBox.(AppCompatCheckBox.java:59)
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.app.AppCompatViewInflater.createCheckBox(AppCompatViewInflater.java:207)
2019-05-30 16:45:17.606 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:126)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.support.v7.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at com.baidu.platform.comapi.wnplatform.p.a.a.a(ResUtils.java:168)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at com.baidu.platform.comapi.walknavi.g.a.(WalkUIController.java:351)
2019-05-30 16:45:17.607 31954-31954/com.icbc.elife W/System.err:     at com.baidu.platform.comapi.walknavi.b.a(WNavigator.java:922)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at com.baidu.mapapi.walknavi.WalkNavigateHelper.startWalkNavi(WalkNavigateHelper.java:349)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at com.easy.sightp.easyar30.view.activity.TestActivity.onCreate(TestActivity.java:80)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at android.app.Activity.performCreate(Activity.java:7183)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.-wrap11(Unknown Source:0)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:105)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at android.os.Looper.loop(Looper.java:164)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6938)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
2019-05-30 16:45:17.608 31954-31954/com.icbc.elife W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
2019-05-30 16:45:17.610 31954-31954/com.icbc.elife E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.icbc.elife, PID: 31954
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.icbc.elife/com.easy.sightp.easyar30.view.activity.TestActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2955)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6938)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
        at com.baidu.platform.comapi.walknavi.g.a.G(WalkUIController.java:849)
        at com.baidu.platform.comapi.walknavi.g.a.H(WalkUIController.java:869)
        at com.baidu.platform.comapi.walknavi.g.a.(WalkUIController.java:352)
        at com.baidu.platform.comapi.walknavi.b.a(WNavigator.java:922)
        at com.baidu.mapapi.walknavi.WalkNavigateHelper.startWalkNavi(WalkNavigateHelper.java:349)
        at com.easy.sightp.easyar30.view.activity.TestActivity.onCreate(TestActivity.java:80)
        at android.app.Activity.performCreate(Activity.java:7183)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) 
        at android.os.Handler.dispatchMessage(Handler.java:105) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6938) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) 

百度导航的view是通过内部获取的

// Inflate the layout for this fragment
        mNaviHelper = WalkNavigateHelper.getInstance();
        //定制化UI
        WalkNaviDisplayOption option = new WalkNaviDisplayOption();
        mNaviHelper.setWalkNaviDisplayOption(option);
        try {
            View view = mNaviHelper.onCreate(TestActivity.this);
            if (view != null) {
               setContentView(view);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

报错的一行是mNaviHelper.onCreate(TestActivity.this);,刚开始我debug调试了N遍,百度地图SDK确认N遍确认是没有错的,最后每一个点都和demo作比较,唯一不同的是他的Activity是直接继承Activity,而我的是继承AppCompatActivity,所以我尝试换成Activity后就行了,你们说坑不坑爹,其实log中有提示,只是我资历不够,没看出来。log里面都是报at android.support.v7.widget.AppCompatDrawableManager。是吧,哈哈哈

你可能感兴趣的:(百度导航的坑Caused by: android.content.res.Resources$NotFoundException: Resource ID)