mikepenz / MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
https://mikepenz.dev
Apache License 2.0
11.67k stars 2.05k forks source link

Crash with Crossfade after updating Google libs #2785

Closed fmeneuhe closed 2 years ago

fmeneuhe commented 2 years ago

On MaterialDrawer 6.1.2 , the app crashes when trying to build the crossfade:

The crash message: Caused by: java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to androidx.slidingpanelayout.widget.SlidingPaneLayout$LayoutParams at com.mikepenz.crossfader.Crossfader.setLeftMargin(Crossfader.java:394) at com.mikepenz.crossfader.Crossfader.build(Crossfader.java:306)

The code: mCrossFader = new Crossfader() .withContent(findViewById(R.id.content_frame)) .withFirst(mDrawer.getSlider(), first) .withSecond(vDrawer, second) .withSavedInstance(savedInstanceState).withGmailStyleSwiping() .build();

I just updated some Google libs and some other libs.

mikepenz commented 2 years ago

Thank you for the report @fmeneuhe . This has been reported before: https://github.com/mikepenz/MaterialDrawer/issues/2767#issuecomment-1072230064

Sadly the new version of the SlidingPaneLayout was significantly modified and is thus no longer supported by the Crossfader library. (I did investigate that a few months back, but couldn't find time to support that anymore)

Given that the crossfader library is no longer supported, it requires to force the previous sliding pane layout:

https://github.com/mikepenz/MaterialDrawer/blob/develop/app/build.gradle#L72-L74 https://github.com/mikepenz/MaterialDrawer/issues/2767#issuecomment-1054666647