Problem with BottomNavigationView: Unable to find resource ID

-1

Good morning,

I searched several times and could not find a solution to solve a problem I'm having with BottomNavigationView. Come on, in my Activity I have the following code

<?xml version="1.0" encoding="utf-8"?>

<android.support.design.widget.BottomNavigationView
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="?android:attr/windowActionBar"
    app:menu="@menu/menu_navigation">

</android.support.design.widget.BottomNavigationView>

When starting the application, the following error occurs:

**E/AndroidRuntime: FATAL EXCEPTION: main
              Process: br.com.inclass, PID: 25119
              java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.inclass/br.com.inclass.activitys.student.DisciplineStudent}: android.view.InflateException: Binary XML file line #27: Binary XML file line #27: Error inflating class android.support.design.widget.BottomNavigationView
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2750)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2811)
                  at android.app.ActivityThread.-wrap12(ActivityThread.java)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:154)
                  at android.app.ActivityThread.main(ActivityThread.java:6316)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
               Caused by: android.view.InflateException: Binary XML file line #27: Binary XML file line #27: Error inflating class android.support.design.widget.BottomNavigationView
               Caused by: android.view.InflateException: Binary XML file line #27: Error inflating class android.support.design.widget.BottomNavigationView
               Caused by: java.lang.reflect.InvocationTargetException
                  at java.lang.reflect.Constructor.newInstance0(Native Method)
                  at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                  at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                  at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                  at br.com.inclass.activitys.student.DisciplineStudent.onCreate(DisciplineStudent.java:28)
                  at android.app.Activity.performCreate(Activity.java:6757)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2703)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2811)
                  at android.app.ActivityThread.-wrap12(ActivityThread.java)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:154)
                  at android.app.ActivityThread.main(ActivityThread.java:6316)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
               Caused by: android.content.res.Resources$NotFoundException: Drawable (missing name) with resource ID #0x0
               Caused by: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x0**

Below my dependencies:

dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.android.support:design:27.1.1'

}

I did a test creating a Toolbar and a FrameLayout and removed the BottomNavigationView, it starts normally ... But when I come back, the same problem occurs. Has anyone caught something like this? I need a help

    
asked by anonymous 26.06.2018 / 15:45

1 answer

1

I tried to remove the property below to test:

android:background="?android:attr/windowActionBar"

If it does not work, there are several possible workarounds for this error in the topic below. link

    
26.06.2018 / 16:55