# Compile JUCE-Android project on Windows

**URL:** <https://forum.juce.com/t/compile-juce-android-project-on-windows/15145>\
**Category:** Android\
**Created:** [July 20, 2015, 5:50pm UTC](https://forum.juce.com/t/compile-juce-android-project-on-windows/15145 "2015-07-20T17:50:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![loopfine](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/loopfine/32/141_2.png) [@loopfine](https://forum.juce.com/u/loopfine)\
**Post date:** [July 20, 2015, 5:50pm UTC](https://forum.juce.com/t/compile-juce-android-project-on-windows/15145/1 "2015-07-20T17:50:47Z")

</div>

Hi, I know many people don't like Linux, and some of them don't have OSX machine, so how to compile JUCE-Android project on Windows is their desires. I found an easy way to accomplish it. If this little tip could help you, it'll be my pleasure.

**1. Setup Compile Envionment On Windows (7)**

1.1 Download and install/unzip JDK, Android SDK, NDK to your local disk. For example,&nbsp;SDK and NDK locate in&nbsp;(you may change the bold texts to&nbsp;adapt your situation):

C:\Users\ **yourLoginName** \SDKs\android-sdk

C:\Users\ **yourLoginName** \SDKs\android-ndk

1.2&nbsp;Add envionment variables to Windows. For example:

PATH:&nbsp;%JAVA\_HOME%\bin;C:\Users\ **yourLoginName** \SDKs\ant\bin;C:\Users\ **yourLoginName** \SDKs\android-sdk\tools;C:\Users\ **yourLoginName** \SDKs\android-ndk;C:\Users\ **yourLoginName** \SDKs\android-ndk\toolchains\arm-linux-androideabi- **4.8** \prebuilt\ **windows-x86\_64** \bin

1.3&nbsp;Open the&nbsp;SDK Manager which locates in&nbsp;Android&nbsp;SDK dir, download and install Tools, API, etc. The API version must matching the "Minumum SDK version" which you will find it in Introjucer's Android project settings&nbsp;later on.

Get the&nbsp;things&nbsp;above done&nbsp;once&nbsp;and&nbsp;for&nbsp;ever, there is no need doing these boring grinds again if the stupid Windows works normal.

**2. Create Android project in Introjucer**

Just create, do some settings and save the project.

**3. Modify the&nbsp;build.xml**

3.1&nbsp;The file build.xml locates in "..\yourProject\Builds\Android". Using a text editor application open it,&nbsp;search&nbsp;for " **${ndk.dir}/ndk-build**", &nbsp;replace to " **${ndk.dir}/ndk-build.cmd**". There are 2 places need to be modified:&nbsp;line 9 and line 23. This is the most important step for compile the JUCE-Android project on Windows.

However, I hope JUCE team could add few lines,&nbsp;using a JUCE platform MACRO and a String object to replace the &nbsp;literal "${ndk.dir}/ndk-build"&nbsp;in "..\extras\Introjucer\Source\Project Saving\jucer\_ProjectExport\_Android.h", line 617 and 646. If so, it'd very helpful for all JUCE Windows-Android user.&nbsp;I know Windows is a bad thing for Android though...

3.2 Save build.xml in the text editor.&nbsp;Don't save the project again in Introjucer since it'll generate the build.xml again.

**4. Compile**

4.1&nbsp;Run "cmd" (Windows commad-line window), into&nbsp;&nbsp;"..\yourProject\Builds\Android". You could do this easily from the file browser: don't select any file or dir, shift+right click, in the popup menu select "Into command-line window from here" (maybe another words since my Windows OS is non-English&nbsp;version).

4.2&nbsp;In the cmd window, type: "ant debug", or "ant&nbsp;release". After a while, the Android APK file of your project will be generated in "..\Builds\Android\bin".&nbsp;

**5. Enjoy!**

---

<div class="post-metadata">

**Author:** ![Jordan\_Harris](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Jordan\_Harris](https://forum.juce.com/u/Jordan_Harris)\
**Post date:** [July 26, 2015, 9:11pm UTC](https://forum.juce.com/t/compile-juce-android-project-on-windows/15145/2 "2015-07-26T21:11:32Z")

</div>

Thank you very much for posting this! This post made it a breeze figuring out how to build a JUCE Android app from the command line. I had no idea it was so easy to do.&nbsp;

---

<div class="post-metadata">

**Author:** ![loopfine](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/loopfine/32/141_2.png) [@loopfine](https://forum.juce.com/u/loopfine)\
**Post date:** [July 26, 2015, 11:55pm UTC](https://forum.juce.com/t/compile-juce-android-project-on-windows/15145/3 "2015-07-26T23:55:03Z")

</div>

Glad to hear you built your JUCE-Android project on Windows.&nbsp;Congratulations!

---

<div class="post-metadata">

**Author:** ![Aros](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Aros](https://forum.juce.com/u/Aros)\
**Post date:** [November 10, 2015, 11:39am UTC](https://forum.juce.com/t/compile-juce-android-project-on-windows/15145/4 "2015-11-10T11:39:03Z")

</div>

Hi, I tried your approach but I get this output while trying _ant release_:

&nbsp;

```
c:\Users\Aros\C++ libs\JUCE-master\examples\Demo\Builds\Android\build.xml:32: Ca
nnot find C:\Users\Aros\SDKs\android-sdk\tools\ant\build.xml imported from c:\Us
ers\Aros\C++ libs\JUCE-master\examples\Demo\Builds\Android\build.xml
```

&nbsp;

Well, of course it cannot. I have installed android-sdk somewhere else. But how do I explain the build to look for it somewhere else?

In build.xml there's this line (32):

\<import file="${sdk.dir}/tools/ant/build.xml"/\>

&nbsp;

Well, how do I set ${sdk.dir} to point to my android-sdk folder?

&nbsp;

Thanks

&nbsp;

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [November 10, 2015, 5:54pm UTC](https://forum.juce.com/t/compile-juce-android-project-on-windows/15145/5 "2015-11-10T17:54:31Z")

</div>

You can set the SDK path in the Introjucer:&nbsp;in Introjucer's global preferences (Tools -\> Global Preferences...) or by clicking on&nbsp;the Android project in the Config tab and modifying the Android SDK Path/Android NDK Path settings on the RHS of the window.

---

<div class="post-metadata">

**Author:** ![Aros](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Aros](https://forum.juce.com/u/Aros)\
**Post date:** [November 11, 2015, 11:17am UTC](https://forum.juce.com/t/compile-juce-android-project-on-windows/15145/6 "2015-11-11T11:17:09Z")

</div>

Sorry, I have seen this option in Introjucer, but somehow I read it/understood it as JDK.

&nbsp;

Anyway now, it tries to compile the Demo, but ends up with:

&nbsp;

```
[exec] jni/../../../Source/../JuceLibraryCode/modules/juce_audio_processors/../../../../../modules/juce_audio_processors/../juce_gui_basics/../juce_graphics/juce_graphics.h:105:60: fatal error: contexts/juce_LowLevelGraphicsSoftwareRenderer.h: No such file or directory
[exec] #include "contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
[exec] ^
[exec] compilation terminated.
```

&nbsp;

I cloned the repo again, so it should be the latest version.

&nbsp;

I found a solution here: http://www.juce.com/forum/topic/juce-demo-android-build-problem

&nbsp;

It seems I am in the very same situation as robiwan was and adding -I "../../../../modules/juce\_graphics" -I "../../../../modules/juce\_data\_structures" to the extra compiler flag solved this problem (I don't think that is my fault, maybe someone should look at it), but there is another while compiling juce\_opengl.cpp:

&nbsp;

```
[exec] [armeabi] Compile++ thumb: juce_jni <= juce_opengl.cpp
[exec] In file included from jni/../../../../../modules/juce_graphics/image_formats/juce_PNGLoader.cpp:266:0,
[exec] from jni/../../../../../modules/juce_graphics/juce_graphics.cpp:118:
[exec] jni/../../../../../modules/juce_graphics/image_formats/pnglib/png.c: In function 'int juce::pnglibNamespace::png_icc_profile_error(png_const_structrp, png_colorspacerp, juce::pnglibNamespace::png_const_charp, juce::pnglibNamespace::png_alloc_size_t, juce::pnglibNamespace::png_const_charp)':
[exec] jni/../../../../../modules/juce_graphics/image_formats/pnglib/png.c:1734:1: internal compiler error: Segmentation fault
[exec] }
[exec] ^
[exec] Please submit a full bug report,
[exec] with preprocessed source if appropriate.
[exec] See <http://source.android.com/source/report-bugs.html> for instructions.
```

&nbsp;

Now that is very strange. Compiler segmentation fault? Well well....

&nbsp;

I tried again and it built the apk with no problem. But it seems suspicious at least...
