Skip to content

Dioxus CSS Asset fails to load during serve (Android) #5628

Description

@rdelacrz

Problem

A CSS file referenced with Dioxus asset! in an Android app does not load during dx serve --platform android.

The stylesheet exists at assets/tailwind.css and is referenced from the document head with:

document::Stylesheet { href: asset!("/assets/tailwind.css") }

Dioxus emits a hashed URL like:

/assets/tailwind-dxh935a5e23476ca8af.css

The Android build copies that hashed CSS into the generated Android asset bundle, but the dev HTTP server does not serve the same file from /assets/..., so the browser/WebView request returns 404 and the page renders without styling.

Steps To Reproduce

Steps to reproduce the behavior:

  • Clone or open the minimal repro project in this directory: https://github.com/rdelacrz/dioxus-asset-404-repo

  • From the repro root, run:

    cargo check --no-default-features --features web
    python3 verify_repro.py
    
  • The script starts:

    dx serve --platform android --port 8099 --watch false --hot-reload false --interactive false
    
  • Observe that the hashed CSS exists in Android output:

    target/dx/dioxus-android-asset-404-repro/debug/android/app/app/src/main/assets/tailwind-dxh*.css
    
  • Observe that the matching file is missing from the dev server public assets directory:

    target/dx/dioxus-android-asset-404-repro/debug/web/public/assets/
    
  • Observe that the dev-server URL returns 404:

    http://127.0.0.1:8099/assets/tailwind-dxh*.css
    

Expected behavior

A stylesheet referenced with asset!("/assets/tailwind.css") should load successfully during Android dx serve.

From the Dioxus side, Android asset! output and dev-server /assets/... serving should use the same asset source in dev mode. Possible fixes:

  • copy/sync Android client hashed assets into the fullstack/dev server public assets directory;
  • serve Android bundled assets through the /assets/... dev-server route;
  • or generate Android dev URLs that route through the native Android asset resolver instead of the HTTP server.

Screenshots

See attached

Image

. The automated repro prints the failing condition:

Android hashed asset exists: .../android/app/app/src/main/assets/tailwind-dxh935a5e23476ca8af.css
Matching server public asset exists: False
Requesting dev-server asset URL: http://127.0.0.1:8099/assets/tailwind-dxh935a5e23476ca8af.css
Observed HTTP status: 404
Confirmed repro: Android asset exists, but dev-server /assets URL returns 404.

Environment:

  • Dioxus version: app dependency pinned to 0.7.1; dx CLI used for this repro was 0.7.9 (3e43ffa)
  • Rust version: rustc 1.96.0 (ac68faa20 2026-05-25)
  • OS info: Linux Ubuntu kernel 7.0.0-22-generic x86_64
  • App platform: Android via dx serve --platform android

Questionnaire

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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