GainDemo on Android, .mp3: Unable to load file


I’m having an issue running GainDemo from the DSP examples on Android. While the Load File… button works with .mp3 files using the Xcode exporter, the same function returns Unable to load file on Android.

.wav files work in both environments.

The only warnings that show up when building in Android Studio are related to juce_posix_SharedCode.h. The warnings went away by downloading the file from the develop branch as shown in this post . The problem persists though – screen captures below.

Could someone try the GainDemo example project on Android Studio? The septs to re-create are:

  1. Have Android Studio installed with an Android Virtual Device ready to roll. I used Nexus 5X API 28. Load both a .wav file and an .mp3 file to the AVD.
  2. Go to the menu File > Open Example > DSP > GainDemo.
  3. Create the Android Exporter
  4. Select Android on Selected Exporter on top.
  5. Hit the Android icon.
  6. Run ‘app’ on Android Studio with ^+R or the ‘play’ button.
  7. Load the appropriate file with the corresponding button.

In this example, the Load File... button works only once. You need to close the app and re-open. This is true for any platform.

Any help is appreciated. I need to load .mp3 files. If also we make the Load Button... work more than once, even better.


#StayHome #StayCool

Just a guess, but did you enable JUCE_USE_MP3AUDIOFORMAT in the juce_audio_formats module in the projucer? It’s disabled by default – for legal reasons afaik. Maybe iOS & MacOS come with some legal built-in mp3 support from the OS side that allows to load mp3 even if the option is disabled, that would explain why it works for you on apple platforms as you describe.

However, that’s just a guess

1 Like

That worked on Android Studio on OSX. Thank you. Yet, it doesn’t work on Android Studio on Win64.


The problem persists in the AS emu on Win64 where I need to run. Despite enabling JUCE_USE_MP3AUDIOFORMAT on the juce_audio_formats module, an MP3 dile cannot yet be loaded on Android Studio on Windows, same emulator, same versions, same project. If it runs on the AVD in AS on OS X, I wonder what the problem is with the same AVD in AS in Win 64.