-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
I now successfully made use of this crate in a bevy app on android. But I had to jump through some hoops first and wanted to share this here in case other follow me on a similar path:
native-tlsdefault feature makes cross compilation harder. In my case building on a macos system I got error messages that compiling openssl failed.
error: failed to run custom build command for `openssl-sys v0.9.102`
Caused by:
process didn't exit successfully: `/Users/stephan/code/rustunit/tinytakeoff/target/debug/build/openssl-sys-88dbd1acfe60b210/build-script-main` (exit status: 101)
[...]
--- stderr
thread 'main' panicked at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.102/build/find_normal.rs:190:5:
Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
compilation process.
[...]
Switching to the rustls-tls feature fixed that and works across all platforms so IMO is a good default we may consider for this crate:
bevy_mod_reqwest = { version = "0.14", default-features = false, features = ["rustls-tls","json"] }
- Issues resolving DNS: No that it compiles and deploys to the emulator or phone, another gotcha is that you actually have to add the
INTERNETpermission to your manifest in order for android to allow you to connect to the internet and the shape this problem manifests withreqwestis error messages of DNS names not being resolved:
06-22 17:15:23.146 6887 6945 E event /Users/foo/.cargo/git/checkouts/bevy_mod_reqwest-d9be43413296dc59/c30cf2a/src/lreqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("yourdomain.com")), port: None, path: "/api/register", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("dns error", Custom { kind: Uncategorized, error: "failed to lookup address information: No address associated with hostname" })) }
Fixing this using cargo apk you can add this to your Cargo.toml:
[[package.metadata.android.uses_permission]]
name = "android.permission.INTERNET"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels