Android Studio报错如下:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xx.xx/com.xx.xx.MainActivity}: android.view.InflateException: Binary XML file line #: Error inflating class android.support.design.widget.CoordinatorLayout
解决方案:
同样由于新版AS的androidx与android support不兼容,故旧版替换新版使用时,CoordinatorLayout应更换为如下:
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
ps:近期做课程设计汇总代码所遇,特此记录~