Android Question MediaPlayer.Load from Subfolder in File.DirAssets Works in Debug but Not in Release

hanyelmehy

Well-Known Member
Licensed User
Longtime User
I’m using MediaPlayer.Load(File.DirAssets, "sounds/test.mp3") to load an MP3 file that I placed inside a subfolder (sounds) under the Files tab.
✅ In Debug mode, everything works fine — the media file is found and plays.
❌ However, in Release mode, I get a FileNotFoundException, and the audio doesn't play.
attached test projrct
 

Attachments

  • test.rar
    496.7 KB · Views: 36

walterf25

Expert
Licensed User
Longtime User
I’m using MediaPlayer.Load(File.DirAssets, "sounds/test.mp3") to load an MP3 file that I placed inside a subfolder (sounds) under the Files tab.
✅ In Debug mode, everything works fine — the media file is found and plays.
❌ However, in Release mode, I get a FileNotFoundException, and the audio doesn't play.
attached test projrct
You can not add files in sub-directories inside the assets folder.
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Upvote 0

hanyelmehy

Well-Known Member
Licensed User
Longtime User
please check updated project ,it load image from subfolder normally in relase mode but give error when try to play media player from same subfolder

i found this maybe the reason

Common Causes​

Asset Compression: In release mode, certain file types in subdirectories may get compressed by default, which can break file access if your code expects uncompressed files.
 
Last edited:
Upvote 0
Top