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

[SDK 51] Fonts with spaces fail to load on Android #28937

Open
Mookiies opened this issue May 17, 2024 · 1 comment
Open

[SDK 51] Fonts with spaces fail to load on Android #28937

Mookiies opened this issue May 17, 2024 · 1 comment
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@Mookiies
Copy link

Mookiies commented May 17, 2024

Minimal reproducible example

https://github.com/Mookiies/expo51-font-repo

Made with npx create-expo-app@latest -t bare-minimum

What platform(s) does this occur on?

Android

Did you reproduce this issue in a development build?

Yes

Summary

Loading a font with a space in the file name, e.g. Helvetica Now Display.otf , fails to load on android.

The error is:

Error: Call to function 'ExpoAsset.downloadAsync' has been rejected.
→ Caused by: The 1st argument cannot be cast to type java.net.URI (received class java.lang.String)
→ Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 72: http://localhost:8081/assets/?unstable_path=.%2Fassets%2Ffonts/Helvetica Now Display.otf?platform=android&hash=59bb1b1be854c3f7c9ca3e8d0e62cdd4] 
    at App (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.fontdemo&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:129996:44)
    at withDevTools(App) (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.fontdemo&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:129781:27)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.fontdemo&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:73605:43)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.fontdemo&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:73605:43)
    at AppContainer (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.fontdemo&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:73448:25)
    at main(RootComponent) (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.fontdemo&modulesOnly=false&runModule=true&transform.routerRoot=app&transform.engine=hermes&transform.bytecode=true:116956:28

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 13.6.4
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.20.2 - ~/.asdf/installs/nodejs/18.20.2/bin/node
Yarn: 1.22.10 - ~/.asdf/shims/yarn
npm: 10.5.0 - ~/.asdf/plugins/nodejs/shims/npm
Watchman: 2023.09.04.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /Users//.asdf/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
IDEs:
Android Studio: 2023.3 AI-233.14808.21.2331.11709847
Xcode: 15.2/15C500b - /usr/bin/xcodebuild
npmPackages:
expo: ~51.0.8 => 51.0.8
react: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
Expo Workflow: bare

Expo Doctor Diagnostics

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for issues with metro config
✖ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check native tooling versions

Detailed check results:

This project has native project folders but also has config plugins, indicating it is configured to use Prebuild. EAS Build will not sync your native configuration if the ios or android folders are present. Add these folders to your .gitignore file if you intend to use prebuild (aka "managed" workflow).

One or more checks failed, indicating possible issues with the project.

@Mookiies Mookiies added the needs validation Issue needs to be validated label May 17, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 17, 2024
@Mookiies
Copy link
Author

These fonts have spaces in their PostScript names, so while removing spaces from the file name gets it to load, having those be the same is important as recommended by the expo-font docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants