Android 使用 androidx.camera.view.CameraView无法正常解析。
错误详情如下:
FATAL EXCEPTION: main
Process: 包名*****, PID: 10139
android.view.InflateException: Binary XML file line #8 in com.sd.jn.sxzn.xfys:layout/fragment_videox: Binary XML file line #8 in 包名****/fragment_videox: Error inflating class androidx.camera.view.CameraView
Caused by: android.view.InflateException: Binary XML file line #8 in 包名***:layout/fragment_videox: Error inflating class androidx.camera.view.CameraView
解决办法:app gradle Android下增加:
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
感谢大神贴给的灵感: Android: PreviewView causes crash in dynamic feature module - Stack Overflow