Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Assignees
Labels

Comments

@howard-lingumi
Copy link

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

  1. Create a new react-native project with the latest lottie 6.5.1
  2. Render lottie with a local file uri (see code example)
  3. Add animationFailure callback and log to console.
  4. Notice lottie doesn't render on an android device.
  5. Notice that the logged error from animationFailure is "sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection"
  6. Downgrade lottie to 5.1.6
  7. 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)

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

@TheRogue76
Copy link
Collaborator

TheRogue76 commented Feb 9, 2024

@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.

@matinzd matinzd added the bug label Feb 29, 2024
@matinzd
Copy link
Collaborator

matinzd commented Feb 29, 2024

I will take a look at this.

@matinzd matinzd self-assigned this Feb 29, 2024
@chj-damon
Copy link

same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants