pedant / sweet-alert-dialog

SweetAlert for Android, a beautiful and clever alert dialog
http://pedant.github.io
7.26k stars 1.94k forks source link

java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:null #145

Closed jasoncheng911 closed 7 years ago

wufei-limit commented 7 years ago

Hi, how did you solve this problem?

lucianocheng commented 6 years ago

BTW, for those still following this thread:

This is happening because it's failing to turn the 50% string from pivotX / pivotY into the integer '50', which it needs.

It's failing on this line in OptAnimationLoader.java, specifically the call to .newInstance(c, attrs);

anim = (Animation) Class.forName(name).getConstructor(Context.class, AttributeSet.class).newInstance(c, attrs);

I forked the repo and changed 50% to 50 and it worked. This is the error I was seeing:

java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:null
    at cn.pedant.SweetAlert.OptAnimationLoader.createAnimationFromXml(OptAnimationLoader.java:77)                      
    at cn.pedant.SweetAlert.OptAnimationLoader.createAnimationFromXml(OptAnimationLoader.java:64)
    at cn.pedant.SweetAlert.OptAnimationLoader.createAnimationFromXml(OptAnimationLoader.java:41)
    at cn.pedant.SweetAlert.OptAnimationLoader.loadAnimation(OptAnimationLoader.java:22)

For the record, this repo is unmaintained, and everyone should switch over to @thomper 's fork at https://github.com/pedant/sweet-alert-dialog/ which works perfectly (thanks @thomper !!).

NikunjKapupara commented 6 years ago

Please check your animation file how you have given this **com.androidkotlin.sweetdialog_kotlin.sweet_dialog.Rotate3dAnimation*** (code) xml code and correct it as per your path/package name

<sweet:**com.androidkotlin.sweetdialog_kotlin.sweet_dialog.Rotate3dAnimation**
        sweet:rollType="x"
        sweet:fromDeg="100"
        sweet:toDeg="0"
        sweet:pivotX="50%"
        sweet:pivotY="50%"
        android:duration="400"/>