java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed

android 9.0 api28 

Process: com.liuan.freereader, PID: 30232
    java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed
        at android.graphics.Canvas.checkValidClipOp(Canvas.java:779)
        at android.graphics.Canvas.clipPath(Canvas.java:1007)
        at com.justwayward.reader.view.readview.PageWidget.drawCurrentPageArea(PageWidget.java:217)
        at com.justwayward.reader.view.readview.BaseReadView.onDraw(BaseReadView.java:230)
        at android.view.View.draw(View.java:20234)

报错代码

 canvas.clipPath(mPath0, Region.Op.XOR);

解决方案


        if(Build.VERSION.SDK_INT >= 28){
            canvas.clipPath(mPath0);
        }else {
            canvas.clipPath(mPath0, Region.Op.XOR);
        }

 

你可能感兴趣的:(#,android,Bug处理,#,android9.0)