Jni build Juce Framework for Android on windows issues

Hello everybody,

I'm trying to build the .so file but I don't know how to fix these issues.

First issue:

I think the ndk library is missed the file "atomics.h" so I copy it from some source like this into ndk_path/platforms/android-x/arch-arm/usr/include/sys


Then another prolem comes:

Thanks for any suggest!

I'm afraid I've always said that I'm not even going to attempt doing android builds on Windows myself - the whole build process is messy enough on unix platforms, for which it's designed! I know that other people have got things going on Windows though, so hopefully someone can give you a tip..

So I will try to build it on Linux then report. Can I do that without any problems?

I use OSX myself, but I'm sure linux will be fine.

It's just Windows where expecting a posix-based build system to run without hitches seems a little optimistic! I'm sure lots of people use it though...

I'm using Eclipse to do all the ground-work Android environment / cygwin -type issues,

 - Have you checked/tested your install? Have you built any other Navtive JNI code?

Last time I tried (2 nights ago) it built no problems. I'll try again, and report back here if there's an issue.


I have been having a similar problem! I don't have a solution but maybe some more specifics will help. I am trying to compile a static library for Android at both 32 and 64 bits. I am able to compile fine using the 32-bit Andoid NDK, but I get the error you describe (also shown below) when I use the 64-bit NDK on Windows 7 or OSX. I'm pretty new to Android, but perhaps this has something to do with 64-bit JUCE support?? Anybody? Thoughts?

windows 7 - ndk64

osx - ndk 64

I built it on Linux successfully without any problems yesterday.

Have you actually looked for the sys/atomics.h file to see if it exists? It's there in my install of the NDK (?)

I fixed the problem and it has to do with some updates in the Android L platform that is only available in the 64-bit Android NDK r-10.

  • The NDK has dropped atomics.h for the Android L platform in favor of <stdatomic.h> (source: https://code.google.com/p/android/issues/detail?id=73744). So you can copy atomics.h from the 32-bit NDK into your ndk-r10\platforms\Android-L\<every arch you want to support>\usr\include\sys\
  • Also for NDK-r10, "the sys/timeb.h header has been removed in the next platform version (currently available in NDK r10 in the "L preview" release), since this header and the ftime function have been removed from the POSIX 2008 specification." (source: https://rbcommons.com/s/OpenH264/r/683/). So you can copy timeb.h from the 32-bit NDK into the same place as atomics.h, mentioned above.

That worked for me! It's a bit combersome but I'm guessing it will be fixed eventually on the JUCE side. It must suck constantly having to update the code base to work on all the changing SDKs, platforms, etc. God speed man. 

Now I'm going to try it for 64-bit iOS 7.1. Fingers crossed.




I managed to compile successfully for Android L by doing the following:

  • in juce_StandardHeader.h - changed the include for <sys/atomics.h> to <stdatomic.h>
  • in juce_core.cpp - moved the include for <sys/timeb.h> inside the "#if ! JUCE_ANDROID" statement

However the build failed due to the requirement for Java 7 (major version 51 is newer than 50). Rather than try and solve this I just re-targeted to Android 4.4.

It seems these changes have not made it into the tip? Is it possible to add them? Android compilation with newest NDK is broken without these.