Build errors on Android - "JUCE_MODAL_LOOPS_PERMITTED" macro

Hello Team,

Thanks for your support in advance.

We are exploring JUCE Framework and it’s usage for developing plugin’s…etc

We have developed sample plugin’s using JUCE Framework.

JUCE claims that same source code developed on one platform can be ported onto other platforms without any changes.

Hence we have ported plugin developed for windows platform onto Android platform.

But we have end up with build errors w.r.t functions supported under “ JUCE_MODAL_LOOPS_PERMITTED == 1”.

Note: For Android platform, this macro “JUCE_MODAL_LOOPS_PERMITTED == 0”.

Android platform build errors for below discussed functions:

’juce::FileChooser::browseForFileToOpen() & juce::FileChooser::browseForFileToSave()’

By referring to below link we understood that this is due to Android compatible issues.

Build errors for Android not seen in win/osx/iOS - Android - JUCE

Kindly support us to resolve the above errors on Android platform without doing any code modifications.

Best Regards,

GeethaP.

1 Like

Hi, you’re going to need to change code I’m afraid. I know this is frustrating as I went through the same process a few years ago.

Android doesn’t allow modal loops so everything has to be done via async launching of dialogs which can be launched sync on other platforms.

I guess that the claim is correct if you happened to write everything async in the first place, but if you didn’t then changes will need to be made.

I think @leehu covered all the important points. Modal loops are completely unsupported on Android, so code that uses modal loops cannot be ported. Code that was written with modal loops disabled from the outset should be portable with no additional changes.

For the most part, modal functions have asynchronous equivalents, and it should be reasonably straightforward to convert modal code to be asynchronous.

In a future release of JUCE, we are planning to set JUCE_MODAL_LOOPS_PERMITTED to zero on all platforms by default, which should make it easier to write completely portable code. Of course, it will still be possible to enable modal loops on platforms that support this feature, for backwards compatibility.