[bug] http reqwest
tetuaoro opened this issue · 0 comments
tetuaoro commented
Describe the bug
None of the solutions I've found work for my configuration. So I decided to use https
in localhost. But I run into a problem when declaring my mkcert
signed certificates.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config>
<domain includeSubdomains="true">localhost</domain>
<trust-anchors>
<certificates src="@raw/certs" />
</trust-anchors>
</domain-config>
</network-security-config>
I copied my *.pem
certificates into src-tauri/gen/android/app/src/main/res/raw/certs/
.
Here my error :
* What went wrong:
Execution failed for task ':app:processX86_64DebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Android resource linking failed
ERROR: ~/code/project/src-tauri/gen/android/app/src/main/res/xml/network_security_config.xml:6: AAPT: error: resource raw/certs (aka com.project.app:raw/certs) not found.
EDIT : my question is « why @raw is not resolve ? » and what can I do ?
Reproduction
- add
tauri_plugin_http
and all config in theguide
tauri website - add f my case
https://localhost:3000
tocapabilities
config - generate self-signed certificates with
mkcert
- follow the official doc https://developer.android.com/privacy-and-security/security-config?hl=fr#trust-anchors
- run
cargo tauri android dev
Expected behavior
The android app runs and can make an external reqwwest
Full tauri info
output
[✔] Environment
- OS: Ubuntu 24.4.0 x86_64 (X64)
✔ webkit2gtk-4.1: 2.44.0
✔ rsvg2: 2.58.0
✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
- node: 20.17.0
- pnpm: 9.10.0
- npm: 10.8.2
[-] Packages
- tauri 🦀: 2.0.4
- tauri-build 🦀: 2.0.1
- wry 🦀: 0.46.1
- tao 🦀: 0.30.3
- tauri-cli 🦀: 2.0.2
[-] Plugins
- tauri-plugin-http 🦀: 2.0.1
- tauri-plugin-fs 🦀: 2.0.1
- tauri-plugin-log 🦀: 2.0.1
[-] App
- build-type: bundle
- CSP: null
- frontendDist: ../dist
- devUrl: http://localhost:1420/
Stack trace
No response
Additional context
This is originally a web app built with leptos
. So, there is a server and the desktop version can make a request without problem and without tauri_plugin_http::init
using invoke
fn. This did not work with android
version, so I tried to use https
.