# Building JuceDemo on Android fails

**URL:** <https://forum.juce.com/t/building-jucedemo-on-android-fails/11337>\
**Category:** Android\
**Created:** [August 23, 2013, 10:48am UTC](https://forum.juce.com/t/building-jucedemo-on-android-fails/11337 "2013-08-23T10:48:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbop](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@tbop](https://forum.juce.com/u/tbop)\
**Post date:** [August 23, 2013, 10:48am UTC](https://forum.juce.com/t/building-jucedemo-on-android-fails/11337/1 "2013-08-23T10:48:56Z")

</div>

Hi,

&nbsp;

&nbsp;

I've just checked out Juce's master branch&nbsp;from Git and I've been encountering&nbsp;a lot of issues so far when trying to build JuceDemo.

So after setting up the correct paths for the Android SDK and NDK (and having saved it)&nbsp;I import the project as an Android project in my Eclipse and...

Error in JuceDemo::onCreate! There's an import missing for android.media.AudioManager. Ok easy enough.

&nbsp;

Then I try to run the build.xml and it seems there's a bug in the way the sdk.dir variable is resolved. See below:

> C:\Users\Tbop\Documents\JUCE-master\extras\JuceDemo\Builds\Android\>ant  
> Buildfile: C:\Users\Tbop\Documents\JUCE-master\extras\JuceDemo\Builds\Android\build.xml  
> BUILD FAILED  
> C:\Users\Tbop\Documents\JUCE-master\extras\JuceDemo\Builds\Android\build.xml:30: Cannot find C:\Users\Tbop\Documents\JUCE-master\extras\JuceDemo\Builds\Android\Program FilesAndroidadt-bundle-windo  
> ws-x86\_64-20130729sdk\tools\ant\build.xml imported from C:\Users\Tbop\Documents\JUCE-master\extras\JuceDemo\Builds\Android\build.xml  
> Total time: 0 seconds

Odd path right? Well I've tried the hardcoded way and set the line build.xml:30 to the correct path. But then I've got another issue and this one remains unresolvable so far... Any idea?

> &nbsp;  
> C:\Users\Tbop\Documents\JUCE-master\extras\JuceDemo\Builds\Android\>ant  
> Buildfile: C:\Users\Tbop\Documents\JUCE-master\extras\JuceDemo\Builds\Android\build.xml  
> &nbsp; [taskdef] Could not load definitions from resource anttasks.properties. It could not be found.  
> &nbsp; [taskdef] Could not load definitions from resource emma\_ant.properties. It could not be found.  
> -set-mode-check:  
> -set-debug-files:  
> -check-env:  
> BUILD FAILED  
> C:\Program Files\Android\adt-bundle-windows-x86\_64-20130729\sdk\tools\ant\build.xml:392: Problem: failed to create task or type checkenv  
> Cause: The name is undefined.  
> Action: Check the spelling.  
> Action: Check that any custom tasks/types have been declared.  
> Action: Check that any \<presetdef\>/\<macrodef\> declarations have taken place.  
>    
> Total time: 0 seconds

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 23, 2013, 11:24am UTC](https://forum.juce.com/t/building-jucedemo-on-android-fails/11337/2 "2013-08-23T11:24:10Z")

</div>

Haven't seen any of these issues myself, but I've never been crazy enough to attempt to&nbsp;build&nbsp;Android stuff on Windows..

&nbsp;

Your java error is a bit puzzling though.. Don't understand how that could behave&nbsp;differently for you&nbsp;(?)

---

<div class="post-metadata">

**Author:** ![tbop](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@tbop](https://forum.juce.com/u/tbop)\
**Post date:** [August 23, 2013, 11:48am UTC](https://forum.juce.com/t/building-jucedemo-on-android-fails/11337/3 "2013-08-23T11:48:28Z")

</div>

I'm going to try on my mac then.

Well the import is definitely missing so I don't understand how could that work for everyone without?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 23, 2013, 12:18pm UTC](https://forum.juce.com/t/building-jucedemo-on-android-fails/11337/4 "2013-08-23T12:18:05Z")

</div>

um... I just had a look in the java file, and the import is right there.

&nbsp;

Like I've said a million times, can everyone _please_ check that you're using&nbsp;the latest code before reporting problems!

---

<div class="post-metadata">

**Author:** ![tbop](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@tbop](https://forum.juce.com/u/tbop)\
**Post date:** [August 23, 2013, 1:08pm UTC](https://forum.juce.com/t/building-jucedemo-on-android-fails/11337/5 "2013-08-23T13:08:00Z")

</div>

Uh? Actually you're right I can find it by browsing on the online repository but I don't get it then. Just downloaded the repository as a zip file about 4 hours ago.  
Beforehand I had downloaded the latest release and the bug was definitely there (the reason why I downloaded the master branch instead).

Perhaps a problem of caching with eclipse. In fact,&nbsp;I had weird issues with it recently when opening similar projects twice in a row.

&nbsp;

Sorry about that, what about the ant script error? About to redo the same on my mac to see if I can reproduce it but perhaps is something we should investigate as well later on.

I'll try to see what I can do with this:&nbsp;http://stackoverflow.com/questions/17074286/failed-to-create-task-or-type-checkenv-cause-the-name-is-undefined

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 23, 2013, 1:26pm UTC](https://forum.juce.com/t/building-jucedemo-on-android-fails/11337/6 "2013-08-23T13:26:17Z")

</div>

You're not still using the defunct sourceforge repo are you?&nbsp;[http://www.juce.com/forum/topic/git-repo-which-one-use](http://www.juce.com/forum/topic/git-repo-which-one-use)

---

<div class="post-metadata">

**Author:** ![tbop](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@tbop](https://forum.juce.com/u/tbop)\
**Post date:** [August 23, 2013, 1:44pm UTC](https://forum.juce.com/t/building-jucedemo-on-android-fails/11337/7 "2013-08-23T13:44:56Z")

</div>

No no I'm using the correct one. I think something went&nbsp;wrong at one point with eclipse and that the former version I had opened before updating to the latest build was still&nbsp;cached in eclipse only, somehow

&nbsp;

The mac version seems to work properly at least, should be enough for what I want to do for now anywaz. Cheers!

---

<div class="post-metadata">

**Author:** ![mucoder](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mucoder/32/595_2.png) [@mucoder](https://forum.juce.com/u/mucoder)\
**Post date:** [August 23, 2013, 4:00pm UTC](https://forum.juce.com/t/building-jucedemo-on-android-fails/11337/8 "2013-08-23T16:00:55Z")

</div>

not sure if this is the same phenomenon,&nbsp;but I got android juce stuff to build on Windows only by getting rid of the relative include paths in juce module includes. &nbsp;Seems to be due to a path length limitation in the NDK tools for Windows

&nbsp;

for instance in&nbsp;JuceLibraryCode\modules\juce\_core\juce\_core.h &nbsp;the following&nbsp;workaround was needed:

// This is an auto-generated file to redirect any included  
// module headers to the correct external folder.  
#if defined (JUCER\_VS2012\_78A501F)  
&nbsp;#include "../../../../../SDKs/juce/modules/juce\_core/juce\_core.h"  
#elif defined **(JUCER\_ANDROID**\_7F0E4A25)  
&nbsp;#include **"/dat/ws/altalogix/alxaudio/trunk/** SDKs/juce/modules/juce\_core/juce\_core.h"  
#elif defined (JUCER\_XCODE\_MAC\_F6D2F4CF)  
&nbsp;#include "../../../../../SDKs/juce/modules/juce\_core/juce\_core.h"  
#elif defined (JUCER\_XCODE\_IPHONE\_5BC26AE3)  
&nbsp;#include "../../../../../SDKs/juce/modules/juce\_core/juce\_core.h"  
#else  
&nbsp;#error "This file is designed to be used in an Introjucer-generated project!"  
#endif  
&nbsp;

no need to edit the .h files of course,&nbsp;you can do this simply by setting the LOCAL JUCE Folder to an absolute path&nbsp;in the introjucer for the Android build

&nbsp;

&nbsp;
