xyxyLiu/SwipeRefreshLayout

java.lang.IllegalArgumentException: Invalid Layer Save Flag - only ALL_SAVE_FLAGS is allowed

Opened this issue · 6 comments

In API:28(Android Pie) when I pull down to refresh app crashes. it works fine in other versions but the crash in Pie. The error is like this :
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.wotu.app.dev, PID: 8152 java.lang.IllegalArgumentException: Invalid Layer Save Flag - only ALL_SAVE_FLAGS is allowed at android.graphics.Canvas.checkValidSaveFlags(Canvas.java:378) at android.graphics.Canvas.saveLayerAlpha(Canvas.java:555) at com.reginald.swiperefresh.CustomSwipeProgressBar.draw(CustomSwipeProgressBar.java:158) at com.reginald.swiperefresh.CustomSwipeRefreshLayout.draw(CustomSwipeRefreshLayout.java:618) at android.view.View.updateDisplayListIfDirty(View.java:19082) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19073) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.support.design.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1254) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20210) at android.view.View.updateDisplayListIfDirty(View.java:19082) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1366) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20210) at android.view.View.updateDisplayListIfDirty(View.java:19082) ...

This issue exists ! What you suggest to do us ? And @sudipsadhukhan0295 you closed this if you have solution please share.

This issue exists ! What you suggest to do us ? And @sudipsadhukhan0295 you closed this if you have solution please share.

It's a temporary solution and it works fine.
Change targetSdkVersion 28 or higher to targetSdkVersion 27. Because from 28 or higher only ALL_SAVE_FLAGS is allowed at android.graphics.Canvas.checkValidSaveFlags(Canvas.java:378) .

no solution yet?

Invalid Layer Save Flag - only ALL_SAVE_FLAGS is allowed

target 27。。。。

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    canvas.saveLayerAlpha(mClipRect, 0);
                } else {
                    canvas.saveLayerAlpha(mClipRect, 0, 0);
                }

fixed.... about....

If you don't need the progress bar to be shown, you can set
swipeRefreshLayout.enableTopProgressBar(false) and it solves this issue.