You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lottie 6.5.1: Source uri to local file not working on android. Error: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection
#1178
Open
howard-lingumi opened this issue
Feb 7, 2024
· 3 comments
When upgrading from Expo 49 to Expo 50, Lottie was upgraded from 5.1.6 to 6.5.1. Before the upgrade I was able to use the uri from a local (dynamically downloaded) lottie file however in the newest version this does not work on android. It does still seem to work on iOS.
When logging the error from animationFailure I get: Error: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection.
It should be noted that using a remote url is working correctly, it is only when the uri is from the filesystem. Thank you for all the great work on Lottie, and thanks in advance for any help you are able to provide.
Steps to Reproduce
Create a new react-native project with the latest lottie 6.5.1
Render lottie with a local file uri (see code example)
Add animationFailure callback and log to console.
Notice lottie doesn't render on an android device.
Notice that the logged error from animationFailure is "sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection"
Downgrade lottie to 5.1.6
Notice that same code now works as expected.
Expected behavior: Local lottie animation to render using the LottieView
Actual behavior: No lottie animation was rendered and animationFailure returned an error (see above)
@matinzd I haven't been too involved on the Android side of things. Can you take a look? This is a rather interesting use case that I don't think we ever thought about.
Description
When upgrading from Expo 49 to Expo 50, Lottie was upgraded from 5.1.6 to 6.5.1. Before the upgrade I was able to use the uri from a local (dynamically downloaded) lottie file however in the newest version this does not work on android. It does still seem to work on iOS.
When logging the error from
animationFailure
I get:Error: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection
.It should be noted that using a remote url is working correctly, it is only when the uri is from the filesystem. Thank you for all the great work on Lottie, and thanks in advance for any help you are able to provide.
Steps to Reproduce
animationFailure
callback and log to console.animationFailure
is "sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection"Expected behavior: Local lottie animation to render using the LottieView
Actual behavior: No lottie animation was rendered and
animationFailure
returned an error (see above)Minimal reproduction
Minimal Reproduction of issue with Expo 50 and Lottie 6.5.1: https://gitlab.com/howard18/lottie-local-file-uri-repro/-/tree/main/lottie-6-issue
Same code working with Expo 49 and Lottie 5.1.6: https://gitlab.com/howard18/lottie-local-file-uri-repro/-/tree/main/lottie-5-working
React Native Environment
System:
OS: macOS 14.2.1
CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
Memory: 282.30 MB / 32.00 GB
Shell:
version: 3.2.57
path: /bin/bash
Binaries:
Node:
version: 14.21.3
path: ~/.nvm/versions/node/v14.21.3/bin/node
Yarn: Not Found
npm:
version: 6.14.18
path: ~/.nvm/versions/node/v14.21.3/bin/npm
Watchman:
version: 2022.11.14.00
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.11.3
path: /Users/Howard/.rvm/rubies/ruby-2.7.2/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.2
- iOS 17.2
- macOS 14.2
- tvOS 17.2
- visionOS 1.0
- watchOS 10.2
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode:
version: 15.2/15C500b
path: /usr/bin/xcodebuild
Languages:
Java: Not Found
Ruby:
version: 2.7.2
path: /Users/Howard/.rvm/rubies/ruby-2.7.2/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.4
wanted: 0.73.4
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Lottie Version
Version: 6.5.1
The text was updated successfully, but these errors were encountered: