E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.rita.mpds, PID: 8331
android.view.InflateException: Binary XML file line #91: Binary XML file line #91: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #91: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.example.rita.mpds.Auxiliares.CartaoTipologiaAdapter.onCreateViewHolder(CartaoTipologiaAdapter.kt:17)
at com.example.rita.mpds.Auxiliares.CartaoTipologiaAdapter.onCreateViewHolder(CartaoTipologiaAdapter.kt:15)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6794)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5975)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at android.support.v7.widget.LayoutState.next(LayoutState.java:100)
at android.support.v7.widget.StaggeredGridLayoutManager.fill(StaggeredGridLayoutManager.java:1609)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:683)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:605)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3336)
at android.view.View.measure(View.java:23279)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:23279)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:2226)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.widget.ScrollView.onMeasure(ScrollView.java:566)
at android.view.View.measure(View.java:23279)
at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1502)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:556)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23279)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1638)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:733)
at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:95)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1556)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:803)
at android.view.View.measure(View.java:23279)
E/AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:401)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:898)
at android.view.View.measure(View.java:23279)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2873)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1910)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2221)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1779)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7810)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
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.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
at android.support.design.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:221)
at android.support.design.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:196)
at android.support.design.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:131)
at android.support.design.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:110)
at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:138)
at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:114)
... 83 more
Это ошибка, которую AS дал мне, и я знаю, что на этот тип ответа уже много раз отвечали, но ... Я думаю, что сейчас у нас другая проблема.Я проверил все размеры элементов, которые есть у BottomNavigation, и вот один из примеров:
<vector android:height="24dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M21,9H15V22H13V16H11V22H9V9H3V7H21M12,2A2,2 0,0 1,14 4A2,2 0,0 1,12 6C10.89,6 10,5.1 10,4C10,2.89 10.89,2 12,2Z"/>
Итак, BottomNavigation является частью элемента RecyclerViewи когда я комментирую это приложение запускается, таким образом ... может быть проблема здесь:
<android.support.design.widget.BottomNavigationView
android:id="@+id/nav_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#c2766f"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white"
app:layout_constraintTop_toBottomOf="@id/pageIndicatorView"
app:layout_constraintBottom_toBottomOf="parent"
app:labelVisibilityMode="labeled"
app:menu="@menu/menu_cdu"/>
Меню:
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<item
android:id="@+id/localizacao_barra_cartao"
android:orderInCategory="1"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="Localização">
</item>
<item
android:id="@+id/relatorio_barra_cartao"
android:orderInCategory="2"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="Relatório">
</item>
<item
android:id="@+id/sopiniao_barra_cartao"
android:orderInCategory="3"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="2ª Opinião">
</item>
<item
android:id="@+id/nova_foto_barra_cartao"
android:orderInCategory="4"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
tools:ignore="MenuTitle"
android:visible="true"
android:title="Nova foto">
</item>
</menu>