mapbox / mapbox-navigation-android

Mapbox Navigation SDK for Android
https://docs.mapbox.com/android/navigation/overview/
Other
622 stars 319 forks source link

Error inflating class SummaryBottomSheet #4269

Open KayHung opened 3 years ago

KayHung commented 3 years ago

I add this in my layout

<com.mapbox.navigation.ui.summary.SummaryBottomSheet android:id="@+id/summaryBottomSheet" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="gone" app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior" />

show the layout on the Second screen

 public MyPresentation extends Presentation{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setCanceledOnTouchOutside(false);
        setContentView(R.layout.my_layout);
}

Then I run app and get error

Android API: Mapbox Navigation SDK version:1.4.0

Caused by: android.view.InflateException: Binary XML file line #7 in com.example.carbittest:layout/mapbox_summary_bottomsheet: Binary XML file line #23 in com.example.carbittest:layout/mapbox_partial_summary_peek: Error inflating class Caused by: android.view.InflateException: Binary XML file line #23 in com.example.carbittest:layout/mapbox_partial_summary_peek: Error inflating class Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:854) at android.view.LayoutInflater.createView(LayoutInflater.java:776) at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:930) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:950) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1263) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1119) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1263) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1119) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)

I found the error when use this layout content, landscape screen, it need to getDrawable() and it is null, so the app crash.

<ImageView
        android:id="@+id/dividerImgViewFirst"
        android:layout_width="8dp"
        android:layout_height="8dp"
        android:layout_marginLeft="16dp"
        android:layout_marginStart="16dp"
        app:srcCompat="@drawable/mapbox_ic_circle_black"/>
KayHung commented 3 years ago

@LukasPaczos Do you have any updates about this issue?

LukasPaczos commented 3 years ago

Sorry @KayHung, no updates yet. What is the Android OS version this is reproducible on?

KayHung commented 3 years ago

Sorry @KayHung, no updates yet. What is the Android OS version this is reproducible on? Android 10/9/7/5.5.1