AudioSynthesizer Demo failing to build for Android on Linux

I’m trying to run the compile the AudioSynthe demo with gradlew on the command line and I’m getting this error :

Error while executing process /home/phil/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {-H/media/phil/54AE4F563BCE86E8/DATA/new_dev_tree/new-android-studio-projects/AnotherJuceNDKLinuxDemo/AudioSynthesiserDemo/Builds/Android/app -B/media/phil/54AE4F563BCE86E8/DATA/new_dev_tree/new-android-studio-projects/AnotherJuceNDKLinuxDemo/AudioSynthesiserDemo/Builds/Android/app/.externalNativeBuild/cmake/debug_Debug/armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-16 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/media/phil/54AE4F563BCE86E8/DATA/new_dev_tree/new-android-studio-projects/AnotherJuceNDKLinuxDemo/AudioSynthesiserDemo/Builds/Android/app/build/intermediates/cmake/debug_/debug/obj/armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=/home/phil/Android/Sdk/ndk-bundle -DCMAKE_C_FLAGS=-fsigned-char -DCMAKE_CXX_FLAGS=-fsigned-char -std=c++14 -DCMAKE_TOOLCHAIN_FILE=/home/phil/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/home/phil/Android/Sdk/cmake/3.6.4111459/bin/ninja -GAndroid Gradle - Ninja -DANDROID_TOOLCHAIN=clang -DANDROID_PLATFORM=android-16 -DANDROID_STL=c++_static -DANDROID_CPP_FEATURES=exceptions rtti -DANDROID_ARM_MODE=arm -DANDROID_ARM_NEON=TRUE -DJUCE_BUILD_CONFIGURATION=DEBUG -DCMAKE_CXX_FLAGS_DEBUG=-O0 -DCMAKE_C_FLAGS_DEBUG=-O0}
– Check for working C compiler: /home/phil/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
– Check for working C compiler: /home/phil/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /home/phil/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
– Check for working CXX compiler: /home/phil/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– The ASM compiler identification is Clang
– Found assembler: /home/phil/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
– Configuring done
CMake Error at CMakeLists.txt:29 (add_library):
Cannot find source file:


Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx

CMake Error: CMake can not determine linker language for target: juce_jni
– Generating done

Now that juce_AudioPlayHead.h that it says it can’t find, is there, but I wonder if there’s something else wrong with the path based on where it thinks it’s looking from.

Why is it building a path that goes up so many times, just to get to the /media which is the root of the file system? Could this have anything to do with it?

Does it work if you build via Android Studio?


But running on the command line gives me better error messages.

Then I suspect there’s something wrong with the paths to your JUCE modules, but I’m afraid I can’t say much more than that. Building with gradle works fine for me.

Like I say, the file gradle says it can’t find, IS actually there. At that location.

What I suspect might be the case is that gradle can’t handle that path for some other reason. Perhaps it doesn’t cope with such a long path. Or with so many “…/” etc.

However, that relative path with all the …/ isn’t actually in my Projucer. I set the paths as you would normally, just navigating in Projucer. And in Projucer the modules path looks like this :




When you say it’s working for you, is your gradle using just the absolute path or is it constructing a longer relative path?

Well the first thing to check is if it works if you have a short relative path to your modules. That would indicate a problem using absolute paths.

I’m getting a similar issue - @interstar did you ever resolve this?