老哥们,如果你的项目迭代了好几个大的版本,我建议你先不要去兼容AndroidX。
第一遍修改完之后是这个样子的。
<androidx.constraintlayout.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.ConstraintLayout>
闪退日志
android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class androidx.constraintlayout.ConstraintLayout
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class androidx.constraintlayout.ConstraintLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.constraintlayout.ConstraintLayout" on path: DexPathList[[zip file "/data/app/com.supe.supertest-lCmJ9tQEBeCH09BSy-fiZw==/base.apk"],nativeLibraryDirectories=[/data/app/com.supe.supertest-lCmJ9tQEBeCH09BSy-fiZw==/lib/arm64, /data/app/com.supe.supertest-lCmJ9tQEBeCH09BSy-fiZw==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]
原因是 这个才是 ConstraintLayout 真正的包名。
androidx.constraintlayout.widget.ConstraintLayout
嘎嘎嘎