Android Studio Windows - invalid "#include" statements in Projucer-generated files

Hi there,

Looks like the Projucer is not correctly resolving paths for some #include statements.

I followed the steps outlined in the Android Studio tutorial ( However, I cannot compile the app "as is" with the generated code. Issues include:

  • Some .cpp files in "Builds\AndroidStudio\app\jni" have invalid imports.
    • These modules correctly refer to the relative directory under "JuceModules/<module_name>".
      e.g. "#include "JuceModules/juce_audio_basics/juce_audio_basics.h"
      • juce_audio_basics.cpp
      • juce_core.cpp
      • juce_audio_formats.cpp
      • juce_cryptography.cpp
      • juce_data_structures.cpp
    • These modules incorrectly refer to relative imports, either partially (so some includes are correct) or completely (so all includes are invalid).
      e.g. "#include "native/juce_android_Audio.cpp"" in juce_audio_devices.cpp
      • juce_audio_devices.cpp
      • juce_audio_processor.cpp
      • juce_events.cpp
      • juce_graphics.cpp
      • juce_gui_basics.cpp
      • juce_gui_extra.cpp
      • juce_opengl.cpp
      • juce_video.cpp
      • JuceHeader.h
  • Some module code is missing, even if I choose to create local copies of all the modules.
    • e.g. the "juce_audio_formats" module is missing the "flac" and "oggvorbis" directories.
    • The "zip" module is missing the "zlib" directory.
    • The "juce_graphics" module is missing the "jpglib" and "pnglib" directories.
    • Basically, it looks like sub-directories of sub-directories in modules are not copied across. ("juce_graphics" and "juce_graphics/image_formats" are copied, but not "juce_graphics/image_formats/jpglib")

I'm a newbie to C++ development, am I doing something wrong?

I'm reluctant to change any files, since some of them say they are auto-generated by Projucer.

Until JUCE support CMake/CLion, it seems Android Studio is my best hope of using a JetBrains IDE for developing in JUCE, but if I can't get it to work I will be very sad. :(

1 Like

Hi ldmyers,

For me, the out-of-the-box tutorial project compiles with Android Studio on Windows without any such errors.

Let's see what could be going wrong. Are you using the Projucer? We have been fixing a lot of Android-specific bugs in the last couple of weeks, and they didn't make it into the Projucer yet. So you should use the Introjucer instead, which is always bleeding edge code. Update to the newest JUCE tip, recompile the Introjucer, and then re-save your project from there. Please make sure that you carefully read this guide and follow all the Windows gotchas:

  • Make sure you're on the newest Android Studio 2.0 Beta from the Canary channel
  • Make sure you have the newest version of the Android SDK Tools installed
  • Make sure you always run the Introjucer as Administrator
  • If your project is broken, delete the whole Builds folder, re-save from Introjucer, and re-import from gradle in Android Studio
  • Make sure you switched the toolchain from clang to gcc
  • Make sure your JUCE folder and the project are both on C:\
  • If you want to run the android emulator on Windows and run into HAX-related errors, watch this video

Ultimately, because there are still so many issues on Windows, I highly advise not to use Windows for Android Studio development, but to use OS X or Ubuntu instead. Otherwise you are likely to run into various issues again and again and sometimes there's not much we can do about them except filing the bugs to Google and hoping they get resolved eventually. Let me repeat that: don't develop JUCE apps for Android using Windows. 

Thanks Timur! I did follow your awesome guide, which helped a lot. I didn't realise Introjucer was still available, I'll try that, and using the latest code from GitHub. If all else fails, I will try an Ubuntu VM (which will, in turn, run an Android emulator). Thanks again for your work!