具体错误:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.serenegiant.usbcameratest/com.serenegiant.usbcameratest.MainActivity}: android.view.InflateException: Binary XML file line #32 in com.serenegiant.usbcameratest:layout/activity_main: Binary XML file line #32 in com.serenegiant.usbcameratest:layout/activity_main: Error inflating class com.serenegiant.widget.SimpleUVCCameraTextureView
解决办法:
一般是因为缺少构造函数。吾看了代码,是有这个函数的。于是再看:
Caused by: java.lang.UnsupportedOperationException: TextureView doesn't support displaying a background drawable 2021-12-01 19:35:02.992 11716-11716/? E/AndroidRuntime: at android.view.TextureView.setBackgroundDrawable(TextureView.java:328)
原来是background这个属性已经不支持了,去掉就正常了。