web-dev-qa-db-ja.com

無効なレイヤー保存フラグ-Android 9で許可されているのはALL_SAVE_FLAGSのみです

TargetSdkVersionを28に更新すると、次のエラーが発生します。以前のバージョンで完全に機能するアプリですが、具体的にはAndroid 9でこのエラーが発生します。言及されているgithubリンクをいくつか見ました。基本的な参考文献が6.0.8に更新されたことを理解できません。誰かがそれを修正する方法を教えてくれました。Android Studioコンソールにあるエラーを添付しています。

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.saveLayer(Canvas.Java:455)
        at com.airbnb.lottie.model.layer.BaseLayer.draw(BaseLayer.Java:222)
        at com.airbnb.lottie.model.layer.CompositionLayer.drawLayer(CompositionLayer.Java:100)
        at com.airbnb.lottie.model.layer.BaseLayer.draw(BaseLayer.Java:188)
        at com.airbnb.lottie.LottieDrawable.draw(LottieDrawable.Java:300)
        at Android.widget.ImageView.onDraw(ImageView.Java:1360)
        at Android.view.View.draw(View.Java:20207)
        at Android.view.View.buildDrawingCacheImpl(View.Java:19478)
        at Android.view.View.buildDrawingCache(View.Java:19338)
        at Android.view.View.draw(View.Java:19927)
        at Android.view.ViewGroup.drawChild(ViewGroup.Java:4333)
        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.view.ViewGroup.dispatchDraw(ViewGroup.Java:4112)
        at Android.support.constraint.ConstraintLayout.dispatchDraw(ConstraintLayout.Java:2023)
        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.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.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.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.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.view.ViewGroup.dispatchDraw(ViewGroup.Java:4112)
        at Android.view.View.draw(View.Java:20210)
        at com.Android.internal.policy.DecorView.draw(DecorView.Java:780)
        at Android.view.View.updateDisplayListIfDirty(View.Java:19082)
        at Android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.Java:686)
        at Android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.Java:692)
        at Android.view.ThreadedRenderer.draw(ThreadedRenderer.Java:801)
        at Android.view.ViewRootImpl.draw(ViewRootImpl.Java:3311)
        at Android.view.ViewRootImpl.performDraw(ViewRootImpl.Java:3115)
        at Android.view.ViewRootImpl.performTraversals(ViewRootImpl.Java:2484)
        at Android.view.ViewRootImpl.doTraversal(ViewRootImpl.Java:1460)
        at Android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.Java:7183)
        at Android.view.Choreographer$CallbackRecord.run(Choreographer.Java:949)
        at Android.view.Choreographer.doCallbacks(Choreographer.Java:761)
        at Android.view.Choreographer.doFrame(Choreographer.Java:696)
        at Android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.Java:935)
        at Android.os.Handler.handleCallback(Handler.Java:873)
        at Android.os.Handler.dispatchMessage(Handler.Java:99)
        at Android.os.Looper.loop(Looper.Java:193)
        at Android.app.ActivityThread.main(ActivityThread.Java:6680)
        at Java.lang.reflect.Method.invoke(Native Method)
        at com.Android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.Java:493)
        at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:858)
9
dbenitobaldeon

同じ問題がありました。 Android 9の問題のようです。次のようにして解決しました:

implementation 'com.airbnb.Android:lottie:2.7.0'

お役に立てば幸いです。

11
Johan Fick