pedant / sweet-alert-dialog

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

java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:nul #136

Open lan5572 opened 7 years ago

lan5572 commented 7 years ago

Caused by: 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) at cn.pedant.SweetAlert.SweetAlertDialog.(SweetAlertDialog.java:80) at com.commom.library.BaseActivity.showProgressDialog(BaseActivity.java:203) at manage.o2o.sporch.com.seller.SellerLoginActivity$6.call(SellerLoginActivity.java:171) at rx.internal.operators.OperatorDoOnSubscribe.call(OperatorDoOnSubscribe.java:40) at rx.internal.operators.OperatorDoOnSubscribe.call(OperatorDoOnSubscribe.java:27) at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:44) at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) at rx.Observable.unsafeSubscribe(Observable.java:10142) at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94) at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:107) at android.os.Handler.handleCallback(Handler.java:815)  at android.os.Handler.dispatchMessage(Handler.java:104)  at android.os.Looper.loop(Looper.java:207)  at android.app.ActivityThread.main(ActivityThread.java:5905)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749)  Caused by: 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) at cn.pedant.SweetAlert.SweetAlertDialog.(SweetAlertDialog.java:80) at com.commom.library.BaseActivity.showErrorDialog(BaseActivity.java:235) at com.commom.library.BaseActivity.loginOutByException(BaseActivity.java:278) at com.commom.library.BaseActivity$1.call(BaseActivity.java:258) at com.commom.library.BaseActivity$1.call(BaseActi

gsteigert commented 7 years ago

Facing the same issue here. I managed to fix it by cloning the repo and using it as a module in my project, rather than using the Maven artifact.

sametbars commented 7 years ago

Same error after upgrading gradle plugin version to "com.android.tools.build:gradle:3.0.0-alpha2", alpha1 was fine. I don't know if this upgrade can cause such things but I did not change anything else.

EDIT: proguard is disabled

Nishant-Pathak commented 7 years ago

refer https://github.com/pedant/sweet-alert-dialog/issues/6

gsteigert commented 7 years ago

@Nishant-Pathak In my case it wasn't a proguard issue, since proguard is disabled in my project. I started facing this issue when updating to build plugin "com.android.tools.build:gradle:3.0.0-alpha2". More specifically, the animation couldn't be loaded because when parsing a custom XML attribute, the value of other attribute was being returned, throwing a number conversion exception.

prokash-sarkar commented 7 years ago

'com.android.tools.build:gradle:3.0.0-alpha4' also has the same issue. A better workaround would be going back to ' classpath 'com.android.tools.build:gradle:3.0.0-alpha1'

ogasimli commented 7 years ago

I have the same issue after upgrading to 3.0.0-alpha2 plugin version.

spurts51 commented 7 years ago

yes I also got the same issue this library doesn't supports the canary versions... I guess...

omeramiel commented 7 years ago

I tried to add this: else if (name.equals("cn.pedant.SweetAlert.Rotate3dAnimation")) { anim = new Rotate3dAnimation(c, attrs); }

and it passed. but it crashed afterwards with:

07-18 17:13:34.751 E/AndroidRuntime: FATAL EXCEPTION: main Process: com.multlock.ekeys, PID: 17586 java.lang.NumberFormatException: Invalid float: "50.0%" at java.lang.StringToReal.invalidReal(StringToReal.java:63) at java.lang.StringToReal.initialParse(StringToReal.java:164) at java.lang.StringToReal.parseFloat(StringToReal.java:323) at java.lang.Float.parseFloat(Float.java:306) at android.content.res.TypedArray.getFloat(TypedArray.java:359) at cn.pedant.SweetAlert.Rotate3dAnimation.(Rotate3dAnimation.java:69)

khoatd92 commented 7 years ago

I got the same issue when using com.android.tools.build:gradle:3.0.0-alpha9 . Any solution for that?

khoatd92 commented 7 years ago

Look like @pedant don't maintain this project anymore. :(

haoweizero commented 7 years ago

o(╥﹏╥)o

khoatd92 commented 7 years ago

btw, I already downloaded source code and import as a library and it works fine. No more error.

pcg92 commented 7 years ago

+1

KeyurKba commented 7 years ago

I have same issue with com.android.tools.build:gradle:3.0.0-beta2, and com.android.tools.build:gradle:3.0.0-beta3. can anyone solve this issue?

KD-Dhiren commented 7 years ago

I face the same issue when using "com.android.tools.build:gradle:3.0.0-beta3" how to resolve this problem? if it's not able to fixable, then I may remove this sweet-alert dialog library. and go with simple one.

ga1ya commented 6 years ago

i tried everthing... include download sc.. add proguard .. not be solved

ga1ya commented 6 years ago

@cjztool 你是下载了源码,如何配置的呢?求教

lacuz commented 6 years ago

abandon this library immediatly

ivzb commented 6 years ago

@lacuz suggest another library

sitonthegold commented 6 years ago

works fine for old version , just back to classpath 'com.android.tools.build:gradle:2.3.3' and also ok with :library:1.3. hope this help :D

ivzb commented 6 years ago

@sitonthegold this is not a good option :)

sitonthegold commented 6 years ago

-keep class cn.pedant.SweetAlert.Rotate3dAnimation { public (...); }

@ivzb try to keep class work for me.

pcg92 commented 6 years ago

it can be closed

francescogatto commented 6 years ago

Hi, when i import library folder, AS3 give me errors on this lines of the gradle library

`version = VERSION_NAME group = GROUP

android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion`

pcg92 commented 6 years ago

@Francescogatto You can delete version = VERSION_NAME group = GROUP

and replace compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion`

for your gradle app version, for example in my case: compileSdkVersion 26 buildToolsVersion "26.0.2"

francescogatto commented 6 years ago

thx @pcegarra but after you suggestion i'm having this error

Error:Could not get unknown property 'GROUP' for object of type org.gradle.api.publication.maven.internal.deployer.DefaultGroovyMavenDeployer.

pcg92 commented 6 years ago

@Francescogatto find and remove all the errors xD

francescogatto commented 6 years ago

right.. just remove apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' thx! :)

wazzah-marham commented 6 years ago

@Francescogatto I am having the same issue, can you please help ? I have removed apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' but the error is still there

pcg92 commented 6 years ago

@wazzah-marham https://github.com/pedant/sweet-alert-dialog/issues/136#issuecomment-337208402 change your compile version and remove some maven dependencies

shylendramadda commented 6 years ago

Me too faced similar issue when I upgraded gradle 3.0.0 any solution for this?

anisha219 commented 6 years ago

download library from https://github.com/pedant/sweet-alert-dialog, and import library as module dependency, remove Gradle dependency (compile 'cn.pedant.sweetalert:library:1.3'). it will work.

@shylendramadda

steven123151988 commented 6 years ago

这个怎么搞的 刚升级3.0.0就出现了。现在要返回2.3.3显然是不可能。

thomper commented 6 years ago

If you don't want to download it and add it as a module dependency, I've forked this repo and updated it to work with the latest gradle and the latest version of the library materialish-progress.

To use it, you need to ensure you have jitpack.io in your gradle.build repositories (see https://jitpack.io) then change the compile line to:

compile 'com.github.thomper:sweet-alert-dialog:v1.4.0'

I moved the package in my fork so as not to step on pedant's toes if they decide to come back. It's under com.ontbee.legacyforks.cn.pedant.SweetAlert now so you'll need to change your import statements too to use this fork.

SetareMaghari commented 6 years ago

@thomper but it says: Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.thomper:sweet-alert-dialog:v1.4.0.

thomper commented 6 years ago

@SetareMaghari I haven't got time to troubleshoot this for you, it's working on my end. Have you added jitpack to the correct build.gradle section? See: https://jitpack.io/p/thomper/sweet-alert-dialog/v1.4.0

AmalH commented 6 years ago

@thomper thanks u're saving us time here !

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 !!).

jumaallan commented 6 years ago

Just use this solution from Thomper here : https://jitpack.io/p/thomper/sweet-alert-dialog/v1.4.0

Cheers Man!!!!

scdhao commented 6 years ago

just copy res/anim folder to project

scdhao commented 6 years ago

copy res/anim folder to project edit error_frame_in.xml remove Rotate3dAnimation

kkman2008 commented 6 years ago

it seems working after configuration as following: copy res/anim folder to project edit error_frame_in.xml remove Rotate3dAnimation

Bha91 commented 5 years ago

this solved mine: add this to proguard: -keep class cn.pedant.SweetAlert.Rotate3dAnimation { public (...); }