DrawerSample ClassCastException
When trying to check the samples on the DrawerLayout the app crashes with a ClassCastException:
09-13 15:13:09.244 4701-4701/com.google.androidstudio.motionlayoutexample E/AndroidRuntime: FATAL EXCEPTION: main Process: com.google.androidstudio.motionlayoutexample, PID: 4701 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.androidstudio.motionlayoutexample/com.google.androidstudio.motionlayoutexample.DemoActivity}: java.lang.ClassCastException: android.support.v4.widget.DrawerLayout cannot be cast to android.support.constraint.motion.MotionLayout at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) Caused by: java.lang.ClassCastException: android.support.v4.widget.DrawerLayout cannot be cast to android.support.constraint.motion.MotionLayout at com.google.androidstudio.motionlayoutexample.DemoActivity.onCreate(DemoActivity.kt:35) at android.app.Activity.performCreate(Activity.java:6662) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
This is because the DemoActivity is trying to set to a MotionLayout element a android.support.v4.widget.DrawerLayout type given that for the Drawer sample that uses the motion_12_drawerlayout the root element with id motionLayout is actually a android.support.v4.widget.DrawerLayout
To reproduce it just open the app and try to enter the option DrawerLayoutExample (1/2) or DrawerLayoutExample (2/2)
I belive that moving the id motionLayout from the DrawerLayout to its drawer_layout_content root element is the fix for this scenario.
Thanks for the report. It's now fixed by #25