timbru31 / cordova-plugin-lottie-splashscreen

🐣 🎬 📱 Apache Cordova plugin to show Lottie animations as the splash screen with Airbnb's Lottie wrapper
https://www.npmjs.com/package/cordova-plugin-lottie-splashscreen
MIT License
131 stars 53 forks source link

Android startup crash: java.lang.NumberFormatException LottieFadeOutDuration #221

Closed ben-kn-app closed 4 years ago

ben-kn-app commented 4 years ago

Bug report

In the README is stated that the LottieFadeOutDuration is an integer for Android and 0.5 should work. But it seems to be a long and it doesn't work.

What steps will reproduce the problem?

Expected output

It should work according to the README but it doesn't. If this issue is validated, the Readme should be updated that a LONG is expected and 0.5 results in a FATAL EXCEPTION.

Personally I'm strugling to find a way to fadeOut the animation with the same config.xml for android as ios, what would be a good value?

What do you see instead?

The app crashes after a few seconds, in the adb catlog the following error is shown

Log file of the issue/error

06-12 11:39:06.639  2973  2973 E AndroidRuntime: FATAL EXCEPTION: main
06-12 11:39:06.639  2973  2973 E AndroidRuntime: Process: com.app.p9748CI, PID: 2973
06-12 11:39:06.639  2973  2973 E AndroidRuntime: java.lang.NumberFormatException: For input string: ".5"
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at java.lang.Long.parseLong(Long.java:432)
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at java.lang.Long.valueOf(Long.java:515)
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at java.lang.Long.decode(Long.java:667)
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at org.apache.cordova.CordovaPreferences.getInteger(CordovaPreferences.java:78)
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at de.dustplanet.cordova.lottie.LottieSplashScreen.dismissDialog(LottieSplashScreen.kt:236)
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at de.dustplanet.cordova.lottie.LottieSplashScreen.access$dismissDialog(LottieSplashScreen.kt:23)
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at de.dustplanet.cordova.lottie.LottieSplashScreen$destroyView$1.run(LottieSplashScreen.kt:82)
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:751)
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:95)
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:154)
06-12 11:39:06.639  2973  2973 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6682)

Version information

`cordova-lib@9.0.1 with: cordova-common@3.2.1 cordova-create@2.0.0 cordova-fetch@2.0.1 cordova-serve@3.0.0

Environment: OS: darwin Node: v10.19.0 npm: 6.13.4

Plugins: cordova-plugin-androidx cordova-plugin-androidx-adapter cordova-plugin-camera cordova-plugin-device cordova-plugin-firebasex cordova-plugin-inappbrowser cordova-plugin-ionic-keyboard cordova-plugin-ionic-webview cordova-plugin-lottie-splashscreen cordova-plugin-splashscreen cordova-plugin-statusbar cordova-plugin-whitelist cordova-plugin-x-socialsharing cordova-sqlite-storage es6-promise-plugin ionic-plugin-deeplinks

Android platform:


The "android" command is deprecated. For manual SDK, AVD, and project management, please use Android Studio. For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager


Running /Users/benchini/Library/Android/sdk/tools/bin/avdmanager list target

Available Android targets:==============] 100% Fetch remote repository...

id: 1 or "android-24" Name: Android API 24 Type: Platform API level: 24 Revision: 2

id: 2 or "android-25" Name: Android API 25 Type: Platform API level: 25 Revision: 3

id: 3 or "android-26" Name: Android API 26 Type: Platform API level: 26 Revision: 2

id: 4 or "android-27" Name: Android API 27 Type: Platform API level: 27 Revision: 3

id: 5 or "android-28" Name: Android API 28 Type: Platform API level: 28 Revision: 6

id: 6 or "android-29" Name: Android API 29 Type: Platform API level: 29 Revision: 3

iOS platform: Xcode 11.5 Build version 11E608c

`

Please provide any additional information below.

Checklist

timbru31 commented 4 years ago

I bet you wrote "0.5" in the config.xml, didn't you? Are you using Android Studio?

timbru31 commented 4 years ago

I assume you've hit an AAPT2 bug, I've described a fix here: https://stackoverflow.com/a/55582231/1902598

ben-kn-app commented 4 years ago

Yes I wrote it manually, not using Android Studio (as I'm creating hybrid applications I'm not working in Android Studio). I'm not aware of any other way?

It looks like it strips the leading 0's, I will upgrade gradle and try again.

timbru31 commented 4 years ago

Good news is: The new cordov-android (to be releases soonish) release will update Gradle to v6.5 and hopefully fix this issue once and for all.

ben-kn-app commented 4 years ago

Hmm the gradle update I have to do everytime I add the platform (Which I will forget in a production env and don't want to waste time adjusting my ci for that).

So for now I will just set the fadeoutduration to , which worksaround it and accept the bug untill the new cordova-android version comes out.

@timbru31 Thanks for your very fast and complete answer! Appreciate it a lot.

timbru31 commented 4 years ago

You're welcome. I'll close this issue as this is unfortunately out of scope for this plugin. I'll add a small README note though.

timbru31 commented 4 years ago

cordova-android@9 is now released and should fix this issue for good.