部分接口被廢棄,當targetSDKVersion升級28檢查更嚴格,google被廢棄接口參考文檔:
developer.android.com/reference/a…java
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.taobao.weex.utils.BoxShadowUtil$OverflowBitmapDrawable.draw(BoxShadowUtil.java:402)
at android.view.ViewOverlay$OverlayViewGroup.dispatchDraw(ViewOverlay.java:256)
at android.view.View.draw(View.java:20472)
at android.view.View.updateDisplayListIfDirty(View.java:19274)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4375)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4348)
at android.view.View.updateDisplayListIfDirty(View.java:19234)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:729)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:735)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:850)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:3577)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3373)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2705)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1628)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7917)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1092)
at android.view.Choreographer.doCallbacks(Choreographer.java:893)
at android.view.Choreographer.doFrame(Choreographer.java:812)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1078)
at android.os.Handler.handleCallback(Handler.java:891)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:7539)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Back traces end.
複製代碼
一、targetSDKVersion爲28
二、android系統9.0設備
二、clipPath、clipRect、clipOutPath部分帶參接口被廢棄android
if(Build.VERSION.SDK_INT >= 26){
canvas.clipRect(mClipBounds);
}else {
canvas.clipRect(mClipBounds, Region.Op.UNION);
}
複製代碼
if(Build.VERSION.SDK_INT >= 26){
canvas.clipPath(mPath0);
}else {
canvas.clipPath(mPath0, Region.Op.XOR);
}
複製代碼
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
canvas.clipOutPath(mPath);
} else {
canvas.clipPath(mPath, Region.Op.INTERSECT);
}
複製代碼