Skip to content

[bug] vite file loading on android very slow #14097

@elwerene

Description

@elwerene

Describe the bug

I have a vite backend which listens on port 5173, my hosts wifi ip is 192.168.1.93.

If I run cargo tauri android dev, it opens the app on my android device. Then it takes about 3 minutes to load all vite files. Most of the time the connections are stalled for up to 50s. All files are loaded from tauri.localhost.

In the documentation there's not much about tauri.localhost.

I changed the url of the webview to http://192.168.1.93:5173 via chrome://inspect and the site loaded in about 3 seconds, so I realized sth. is really wrong with this tauri.localhost domain.

My next try was to directly set http://192.168.1.93:5173 in tauri.conf.json at app.windows.url. Somehow it did not change anything. So I tried a different url like https://github.com, that worked. Next try with a wrong ip: http://192.168.1.92:5173 -> Host not reachable.

So I realized my hosts ip is swapped out to the extremly slow tauri.localhost domain. After some tingering I found a workaround which works for my setup to have the tauri app up in seconds:

cargo tauri android dev --config '{"app":{"windows":[{"url":"http://192.168.1.93:5173"}]}}' --host 0.0.0.0

the host argument is needed, so my url is not changed back to tauri.localhost.

I guess this is a bug, at least it is not documented very well what tauri.localhost is. I tried to find the code passages to fix it myself, but I couldn't find it in the tauri source code.

Reproduction

No response

Expected behavior

  1. It works quickly out of the box and needs no workaround.
  2. The documentation explains what tauri.localhost is.

Full tauri info output

[✔] Environment
    - OS: Fedora 42.0.0 x86_64 (X64) (gnome on wayland)
    ✔ webkit2gtk-4.1: 2.48.5
    ✔ rsvg2: 2.60.0
    ✔ rustc: 1.85.0 (4d91de4e4 2025-02-17)
    ✔ cargo: 1.85.0 (d73d2caf9 2024-12-31)
    ✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
    ✔ Rust toolchain: 1.85.0-x86_64-unknown-linux-gnu (overridden by environment variable RUSTUP_TOOLCHAIN)
    - node: 22.11.0
    - yarn: 4.8.1
    - npm: 10.9.0

[-] Packages
    - tauri 🦀: 2.8.4
    - tauri-build 🦀: 2.4.0
    - wry 🦀: 0.53.2
    - tao 🦀: 0.34.2
    - tauri-cli 🦀: 2.8.3
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli : 2.8.3

[-] Plugins
    - tauri-plugin-log 🦀: 2.6.0
    - @tauri-apps/plugin-log : not installed!
    - tauri-plugin-fs 🦀: 2.4.2
    - @tauri-apps/plugin-fs : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:5173/
    - framework: Vue.js
    - bundler: Vite

Stack trace


Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions