Flutter audioplayers apk release does not work

Viewed 2822

I am using Audioplayers Flutter Library for playing assets sound from assets/sounds/my_sound.mp3. I'm using AudioCache like this :

AudioCache.play(mysound)

I am calling this inside a onpressed method from a Raised Button. It's working find when I am playing my sound in the application from my emulator or my device when I was running

flutter run

Working fine.

Now, I generate apk with

flutter build apk

I'm getting the app_release.apk and download it inside my device. Now, I am trying to launch the application. The app load assets images and other contents. But when I'm trying to play a sound, nothing happened...

I am trying to import apk without Google play store for now because I want test my app in production environments.

What's happened? Can I see a log inside my device for debugging the app?

3 Answers

if you playing audio from assets using AudioCache, try to set your AudioPlayer on mode: PlayerMode.LOW_LATENCY

AudioPlayer audioPlayer = AudioPlayer(mode: PlayerMode.LOW_LATENCY);

there is a few Libraries for play audio in app, i introduce them to you:

assets_audio_player

Audio Player / Audio Players / Audio Player 2

Flute Music Player

Fluttery Audio

Stereo

Music Player

but they have other issue for you

You can use one of them related to your work

enter image description here

Add full path instead of file name

Incorret: AudioCache.play(sample.mp3)

Correct: AudioCache.play(assets/sample.mp3)

Related