1.如果View是用类来实现的,需要检查构造方法:
必须有这个构造函数:
public XXXX(Context context, AttributeSet attrs) {
super(context, attrs);
}
2.检查全类名是否正确,若是自定义的需要去复制全类名,若是引用第三方,可以看其案例如何使用,或者看github上的使用介绍
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
android:id="@+id/jcv_videoplayer"
android:layout_width="match_parent"
android:layout_height="220dp"
android:orientation="vertical" />
fm.jiecao.jcvideoplayer_lib 就是类命路径,JCVideoPlayerStandard就相当于自定义的方法名称
1.看是否有明显错误,显示红下划线
2.看jar包是否冲突:
若当前module和其所关联的库中都使用了此jar包,最好以关联库中的jar包为准,
删掉当前module的jar包,取消关联,若是关联的库,也是取消当前的关联3.看SDK编译的版本是否一致:检查当前module和其所关联的库所用的SDK版本是否一致
4.使用debug调试程序
5.重启