-1

Bom dia pessoal,

Procurei diversas vezes e não consegui encontrar uma solução para resolver um problema que estou tendo com o BottomNavigationView. Vamos lá, na minha Activity tenho o seguinte código

<?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>

Ocorre que ao iniciar o aplicativo, ocorre o seguinte erro:

**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**

Abaixo minhas dependências:

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'

}

Fiz um teste criando uma Toolbar e um FrameLayout e retirei o BottomNavigationView, aí inicia normalmente... Mas quando volto, o mesmo problema ocorre. Alguém já pegou algo parecido? Preciso de um help

1 Resposta 1

1

Tentei remover a propriedade abaixo para testar:

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

Caso não funcionar, no tópico abaixo existem várias soluções possíveis para este erro. https://stackoverflow.com/questions/30709419/error-inflating-class-android-support-design-widget-navigationview

1
  • Alterei o background e funcionou Commented 26/06/2018 às 15:47

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .