capacitor-community / capacitor-community/native-audio
Vite build & asset paths, how the hell?
- Dominant language
- Java
- Stars
- 154
- Forks
- 78
- PR merge metrics
- No merged PRs in 30d
Description
I'm clearly missing something with this. I have an app built with vite, direct from Capacitor's quickstart. I've added my audio to `source/assets/sounds`, as seen here:

and so, they build like this in the Android folder:

I've tried preloading the audio in a ton of different ways, looking through different issues, trying different repos such as CapGo, and nothing has worked.
I've tried all of these:
```
assetPath: "public/assets/sounds/bang.1edeb9ba.wav",
assetPath: "public/assets/sounds/bang.wav",
assetPath: "assets/sounds/bang.wav",
assetPath: "sounds/bang.wav",
assetPath: "sounds/bang.1edeb9ba.wav",
assetPath: "assets/sounds/bang.1edeb9ba.wav",
```
Nothing is working? It just throws an error with the path of the file.
The docs are super vague, and the "native-audio-example" seems to only be useful to those who know that exact framework.
Contributor guide
Research direction
Start with the Vite asset output under source/assets/sounds and the generated Android folder, then compare those paths with native-audio-example. Reproduce the preload failure in the Capacitor quickstart using bang.wav and record which assetPath is requested and where the file is generated. Done means identifying a working path or documenting the mismatch clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, vite
- Domain
- audio-video-rtc, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100