美文网首页
android9.0坑:Invalid Region.Op -

android9.0坑:Invalid Region.Op -

作者: 不愿透露姓氏的许先生 | 来源:发表于2019-07-11 17:09 被阅读0次
java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed
        at android.graphics.Canvas.checkValidClipOp(Canvas.java:779)
        at android.graphics.Canvas.clipRect(Canvas.java:826)
        at com.airbnb.lottie.model.layer.CompositionLayer.b(CompositionLayer.java:97)
        at com.airbnb.lottie.model.layer.BaseLayer.a(BaseLayer.java:187)
        at com.airbnb.lottie.model.layer.CompositionLayer.b(CompositionLayer.java:93)
        at com.airbnb.lottie.model.layer.BaseLayer.a(BaseLayer.java:187)
        at com.airbnb.lottie.LottieDrawable.draw(LottieDrawable.java:338)
        at android.widget.ImageView.onDraw(ImageView.java:1360)

报错代码:

canvas.clipRect(mClipBounds, Region.Op.UNION);

在项目中使用了一个三方的lottie,目前版本升级到2.7.0就好了

如果是在自己的项目中遇到解决办法:

if(Build.VERSION.SDK_INT >= 26){
     canvas.clipRect(mClipBounds);
 }else {
     canvas.clipRect(mClipBounds, Region.Op.UNION);
 }

相关文章

网友评论

      本文标题:android9.0坑:Invalid Region.Op -

      本文链接:https://www.haomeiwen.com/subject/afgdkctx.html