sweet-alert-dialog
sweet-alert-dialog copied to clipboard
java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:null
java.lang.RuntimeException: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error:null
You should add this to proguard
-keep class cn.pedant.SweetAlert.Rotate3dAnimation {
public <init>(...);
}
I try the sample,when I change sample's library like this
dependencies { compile 'cn.pedant.sweetalert:library:1.3' // compile project(':library') }
get the same error ,so i think it's not proguard problem
now i use library from github, not use compile 'cn.pedant.sweetalert:library:1.3'
my problem solved
Any solution for this issue?
@mansoorahmadsamar download library for using
Great, Thanks @afinal
@mansoorahmadsamar You are welcome.
can you ask you? you use develop tools is Android Studio3.0? and how reslove? help me @afinal ,you ues local library?
solution:
1 download sc to lead.
2. configuration at proguard-rules.pro
add this:
-keep class cn.pedant.SweetAlert.Rotate3dAnimation { public <init>(...); }
at project gradle.properties
add this:
VERSION_NAME=1.3 GROUP=cn.pedant.sweetalert POM_DESCRIPTION=SweetAlert for Android, a beautiful and clever alert dialog. POM_URL=https://github.com/pedant/sweet-alert-dialog POM_SCM_URL=https://github.com/pedant/sweet-alert-dialog POM_SCM_CONNECTION=scm:[email protected]:pedant/sweet-alert-dialog.git POM_SCM_DEV_CONNECTION=scm:[email protected]:pedant/sweet-alert-dialog.git POM_LICENCE_NAME=The MIT License POM_LICENCE_URL=http://opensource.org/licenses/MIT POM_LICENCE_DIST=repo POM_DEVELOPER_ID=pedant POM_DEVELOPER_NAME=Pedant
at libray build.gradle
change code :
compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion
change it for your own project
Oh yeah and:
Don't forget to
dependencies { compile 'cn.pedant.sweetalert:library:1.3' // compile project(':library') }
As well as <item name="android:windowEnterAnimation">@anim/dialogui_enter_center</item>
You need to remove the @ from the source code
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
I Found a solution , import lib as module
How can I import it as module? I downloaded the .zip from the repo, but im stuck at this point. Can somebody help me pls?
@GHpeter 我是把这个库克隆到本地,然后import as module
@A7med7ani YES
@zedz01 clone this repo, and import as module
clone repo, then import library as module then copy
// VERSION_NAME=1.3 VERSION_CODE=4 GROUP=cn.pedant.sweetalert
POM_DESCRIPTION=SweetAlert for Android, a beautiful and clever alert dialog. POM_URL=https://github.com/pedant/sweet-alert-dialog POM_SCM_URL=https://github.com/pedant/sweet-alert-dialog POM_SCM_CONNECTION=scm:[email protected]:pedant/sweet-alert-dialog.git POM_SCM_DEV_CONNECTION=scm:[email protected]:pedant/sweet-alert-dialog.git POM_LICENCE_NAME=The MIT License POM_LICENCE_URL=http://opensource.org/licenses/MIT POM_LICENCE_DIST=repo POM_DEVELOPER_ID=pedant POM_DEVELOPER_NAME=Pedant
/// in gradle.properties file
and copy in build file
ext { compileSdkVersion = 25 buildToolsVersion = "3.0.0" }
use this library is the same just with new features https://jitpack.io/p/Leogiroux/sweet-alert-dialog
I use this link and that's work like a charm. https://jitpack.io/p/thomper/sweet-alert-dialog/v1.4.0
Between this last two @EvilShok and @amadou009 which one is the "correct"? I guess both are clones of this repo that is 3 years old? or??? it is best to go with the solution posted before https://github.com/pedant/sweet-alert-dialog/issues/148#issuecomment-339949086
@tyoc213 I didn't use #148 but mine work. So you can test them and do your choice. Good luck
hey guys all of you are here post their error mine also shows the same error but the question is do any one solve this issue if yes then give us solution
Well the problem would be solved if @pedant where active, but he seem long gone this years... 😢 (see that there are like 16 pendings PR and the ones referenced are forks)... you should try any of them, for me it worked the first one didnt test the second, but I guess it will work too.
Both of them are forks of this repo by @pedant.
@EvilShok and @amadou009 both answers worked out.. Im using @amadou009 answer
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 !!).
java.lang.RuntimeException appears in Android Studio 3.X using Sweet Alert Dialog: Unknown animation name: cn.pedant.SweetAlert.Rotate3dAnimation error: null error
I read a lot of blogs on the Internet and said that using Sweet Alert Dialog has encountered similar problems. The solution is very strange. Some say that it is to download lib and import it into the project.
Some say it is a confusion problem, in fact, the solution is very simple, you can change the added dependency library.
Errored library, comment out
implementation 'cn.pedant.sweetalert:library:1.3'
Add the following library
implementation 'com.github.f0ris.sweetalert:library:1.5.1'
Ok run again, problem solving
This Library is not maintained
To solve this issue
Modify the File OptAnimationLoader
Add another else condition / case
case "YOURPATH.Rotate3dAnimation":
anim = new Rotate3dAnimation(c, attrs);
break;