F0RIS / sweet-alert-dialog

SweetAlert for Android, a beautiful and clever alert dialog
http://www.pedant.cn
285 stars 82 forks source link

Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:cn.pedant.SweetAlert.Rotate3dAnimation #58

Open daniel-waiguru opened 3 years ago

daniel-waiguru commented 3 years ago

Getting this error after enabling obfuscation, here is a full stack trace

2021-09-11 23:36:45.152 10096-10096/<packagename> E/AndroidRuntime: FATAL EXCEPTION: main
    Process: <packagename>, PID: 10096
    java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:cn.pedant.SweetAlert.Rotate3dAnimation
        at a2.b.b(:83)
        at a2.b.b(:65)
        at a2.b.a(:41)
        at a2.b.c(:22)
        at a2.k.<init>(:125)
        at androidx.fragment.app.Fragment.n1(:2987)
        at androidx.fragment.app.t.f(:546)
        at androidx.fragment.app.t.m(:282)
        at androidx.fragment.app.m.d0(:2189)
        at androidx.fragment.app.m.a1(:2106)
        at androidx.fragment.app.m.a0(:2002)
        at androidx.fragment.app.m$g.run(:524)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:251)
        at android.app.ActivityThread.main(ActivityThread.java:7465)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)

Tried adding the following rules to my proguard-rules.pro file but the error still persists

keep class cn.pedant.** { *; }
-keep class cn.pedant.SweetAlert.Rotate3dAnimation {
    public <init>(...);
 }
-keep class cn.pedant.SweetAlert.Rotate3dAnimation
arif-rahman-cse commented 3 years ago

I am also getting the same error

daniel-waiguru commented 3 years ago

Got a solution Create a file named error_frame_in.xml in your anim folder and add the following content.


<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha android:fromAlpha="0"
        android:toAlpha="1"
        android:duration= "400"
        />
</set>
100CPU commented 3 years ago

I am also getting the same error. What do mean by "anim folder". Where should it be? I use this lib within a mobile app. Where should this xml be stored in this case?

daniel-waiguru commented 3 years ago

I am also getting the same error. What do mean by "anim folder". Where should it be? I use this lib within a mobile app. Where should this xml be stored in this case?

the anim folder means animation folder, can be found in res-resource directory

100CPU commented 3 years ago

I have no animation folder or something like that. Can the above XML entry be in any folder? For example I have a folder called XML in which I set general settings.

daniel-waiguru commented 2 years ago
image

The animation folder is created when you create an animation file normally in anim folder is where all the animations files reside

rezaulkhan111 commented 2 years ago

when app publishes as release mode. inside the 'OptAnimationLoader' class> 'createAnimationFromXml' method> default case ' throw RuntimeException'. I just replace RuntimeException with a break. (library tries to dynamically choose the constructor). image

Dave181295 commented 2 years ago

when app publishes as release mode. inside the 'OptAnimationLoader' class> 'createAnimationFromXml' method> default case ' throw RuntimeException'. I just replace RuntimeException with a break. (library tries to dynamically choose the constructor). image

Nice, but file is read only, how can you modify it?

rezaulkhan111 commented 2 years ago

when app publishes as release mode. inside the 'OptAnimationLoader' class> 'createAnimationFromXml' method> default case ' throw RuntimeException'. I just replace RuntimeException with a break. (library tries to dynamically choose the constructor). image

Nice, but file is read only, how can you modify it?

I downloaded the source code then modified it