App has crashed, executing CustomActivityOnCrash's UncaughtExceptionHandler
android.view.InflateException: Binary XML file line #18 in me.hgj.jetpackmvvm.demo:layout/fragment_home: Binary XML file line #18 in me.hgj.jetpackmvvm.demo:layout/fragment_home: Error inflating class dji.ux.widget.FPVOverlayWidget
Caused by: android.view.InflateException: Binary XML file line #18 in me.hgj.jetpackmvvm.demo:layout/fragment_home: Error inflating class dji.ux.widget.FPVOverlayWidget
Caused by: java.lang.reflect.InvocationTargetException
当我在该框架上使用大疆sdk时,我遇到如下问题
这是错误截图
为了验证我,下载了此项目,将 fragment.xml中加入如下代码
![微信截图_20221103131446](https://user-images.githubusercontent.com/19763500/199652842-9c6c802b-8c73-44ca-a35d-9d32725cfec0.png)
<dji.ux.widget.FPVOverlayWidget android:id="@+id/fpv_overlay_widget" android:layout_width="match_parent" android:layout_height="match_parent" />
#我增加了以下依赖![微信截图_20221103131504](https://user-images.githubusercontent.com/19763500/199652810-6ef3949a-14e8-4468-a7e8-ad8a72059f44.png)
当我使用以下封装时可以正常使用viewbinding
val aClass = (superclass as ParameterizedType).actualTypeArguments[0] as Class<*> try { val method = aClass.getDeclaredMethod("inflate", LayoutInflater::class.java) binding = method.invoke(null, layoutInflater) as T setContentView(binding!!.root) } catch (e: Exception) { e.printStackTrace() }
我不是很清楚您的封装问题出在哪里