Error from inside the Android Tools

edited November 2013 in Android Mode


I am getting a strange errors when compiling sketches for Android. Because if I compile very simple sketches,like the one underneath ,everything works well:

void setup() { size(400, 400, P2D); background(255, 0, 0); fill(255, 150); }

void draw() { ellipse(mouseX, mouseY, 100, 100);

But, if I try to compile any sketch that has more elements I get the "Error from inside the Android Tools".

xml:892: The following error occurred while executing this line: /development/android-sdk-macosx/tools/ant/build.xml:894: The following error occurred while executing this line: /development/android-sdk-macosx/tools/ant/build.xml:906: The following error occurred while executing this line: /development/android-sdk-macosx/tools/ant/build.xml:284: null returned: 2

The same SDK I am sing in Processing is working perfectly on Eclipse.

Any clues?

Thank you,



  • Answer ✓

    Can you provide an example of a sketch that fails to compile? If you are able to compile simple sketches such as these, then that is a bit different than anything I've seen before...

  • if your Java console says

    "[javac] Unable to locate an executable at "/Applications/" (-1)"

    and you are running 10.9 I am having the same problem. and so are many others also.

  • For example, if I just added rectMode(CENTER) to the code that I wrote, it wouldn't compile...

    [javac] Unable to locate an executable at "/Applications/" (-1)"

    No, I didn't get this error...

  • edited November 2013

    I am having the same issue - with the exact same line numbers -- here's a breakdown of those lines in the XML file:

    First android test failed with these errors – I went to the XML file and put the lines in question below: I do not get any "not found" messages.



    892: The following error occurred while executing this line: /usr/share/adt-bundle-linux-x86-20131030/sdk/tools/ant/build.xml:

    894: The following error occurred while executing this line: /usr/share/adt-bundle-linux-x86-20131030/sdk/tools/ant/build.xml:

    906: The following error occurred while executing this line: /usr/share/adt-bundle-linux-x86-20131030/sdk/tools/ant/build.xml:

    284: null returned: 2

    I could not get the xml lines to show up in this post so I have put the android-errors.txt file online here

    Following is the simple code being used from the Android Example in the Processing page's Examples Section.

    void setup() {
      rectMode(CENTER);     // This sets all rectangles to draw from the center point
    void draw() {
      rect(width/2, height/2, 150, 150);

    And, referring to one of the above comments, the same errors occur with or without the rectMode(CENTER) line.

  • edited November 2013

    @dami1 -- I see you have marked this as answered -- but I recieved the same exact same errors as you did and I don't find an answer here? If you fixed your problem would you post the fix here please? Thanks much!

    @harveymoon -- did you find an answer??

    dami1 -- answered means the problem is solved -- not just that someone posted a comment on your question!

  • @clair: When a user presses the "Accept" button (or the "Reject" button, for that matter), it is impossible to revert the state of the answer back to neither of these two conditions. Often, people will press one of these buttons and are stuck with the result.

  • @calsign -- I know -- that's why I put in my comment -- he/she is a new joiner and didn't know what "answered" meant in the context of this forum. That's all. I know it can't be changed.

    And, as far as the question goes -- I've tried everything I can think of including reinstalling the Android SDK and trying with P v. 2.0.2 and 2.0.3. The messages are consistently the same.

    Some people here, judging by the Android discussions, seem to have it working. It would be wonderful if one of them could detail their environments. I'm running on Linux Mint 15, but I am sure there must be users for Mac, Win, and Linux who have this sucker working! Would love it if they would share their secrets.

    When you don't have any "not found" messages, then it must mean that things are not just co-ordinated in the correct manner. I'm going back to regular Processing work and will keep an eye out here for any developments.

  • @clair Make uninstall Android SDK Build-tools 19. Just use 18 version. I had same Problem, but it's working now. (Mac, P 2.03)

  • @jeonghopark I literally can not believe this solved it. I have spent ages trying to get this working! Simply uninstalling Build-tools 19 and using 18.1.1 worked. I still am having issues with emulator but it is building onto my Nexus 5 running Android 4.4.

    @clair - take note!

  • @clair , I am sorry didnt know...

    @jeoghopark, uninstalling the build-tools 19 didnt solve the problem for me...

  • Removing the Build Tools r19 and leaving 18.1 made it work for me. I am building in Nexus 4 with 4.3 from OS X 10.8.5 - I have to add that I had to downgrade Processing from 2.1 to 2.01 to make this work.

  • i have same problem. i got this message

    BUILD FAILED C:\Android\tools\ant\build.xml:892: The following error occurred while executing this line: C:\Android\tools\ant\build.xml:894: The following error occurred while executing this line: C:\Android\tools\ant\build.xml:906: The following error occurred while executing this line: C:\Android\tools\ant\build.xml:284: null returned: 2

    Total time: 25 seconds

    its work when the code is

    void setup(){}

    void draw(){


    when i add background(0) to the void draw it will got an error like i write above

    edit the androidmanifest.xml its doesn't work at all

    processing 2.1 32bit ,windows8 64bit device lenovo p780

  • edited November 2013

    @idsc54, what version of the Android SDK are you using?

  • edited November 2013

    @calsign revision 22.3 API 19

    i've try edit android manifest

      uses-sdk android:minSdkVersion="10"/
        android:targetSdkVersion="18" /

    is it posibble the problem from the device?

  • @calsign i've read another discussion

    the solution of the problem is to downgrade sdk build-tools 19 to 18.1

    it work now. thank you :)

  • Use a pi 10 and build tools 18.1

  • After my Android S3 upgraded to 4.3, my sketches had this problem. Uninstalling sdk build-tools 19 fixed the problem. Thank you so much!

  • Hello! yep, the same here. Im new to this whole scene but now have the simple polygon, 2D rotating shapes running on my Samsung Galaxy, after deleting Build tools 19 in the SDK manager. I do still however have 22.3 STILL installed as well as 18.1 and 18.1.1

    I also still have all the other 19 related things installed -just removed the 19 build tools.

    Mac OS X 10.6.8 Snow Leopard Process2 v 2.0.3 (can run 2.1 on this version of mac os X - pity, but not doing 10.7)

    BRILLANT - it now works on an actual Android device, plugged into my mac (once I have enabled debug mode on the device)

    BUT also, I manually set up an Android 2.3.3 API 10 device EMULATOR in the

    Processing/ Android/Android AVD Manager option

    which you ONLY find if you have selected the "Android" mode in the process PDE.

    however that wouldn't work.


    I already had 2 other devices set up in my AVD , a tablet and a HTC device. Ive never got either to work in eclipse or anything.

    when I tried

    Sketch/ Run in Emulator, it started to build, wrote all the correct things but then failed with the "Red Herring" warning, … and in the message in the Bottom, build console window about having more than one device installed and having to specify one via

    the "platform had more than one ABI' and to please specify which with the --abi command." error

    I couldn't find how/where, to specify or change the default AVD so checked in the AVD directory which,if on a a mac 10.6, is in the hidden directory

    /Users/'Yourusernamehere'/.android/AVD (note the " . " before android)

    and there I could see my 3 AVD versions.


    so then, via the Android AVD panel, I deleted all my previous AVDs, so there were NO AVD Emulators, but that still didn't work so after some googling, I realised that I had the INTEL ATOM …installed in the 10 API , ANDROID 2.3.3 , which showed up in the Android SDK panel

    so based on

    I deleted this in the API 10 install of the Android SDK Panel then tried again.

    Then ran simple program in EMULATOR first time

    FAIL….as…… my Emulator took an age to load, -the Processing PDE asked "is the emulator running?" or something simulator


    I saw Processing-0217.avd Processing-0217.ini

    appear in /Users/'Yourusernamehere'/.android/AVD as I did this!

    Processing 2 had created my AVD for me :) Good shout guys! :D

    I then let the emulator carry on loading (for some time) until it had the background and all the pretty buttons etc and just clicked Sketch/ Run in Emulator a 2nd time and…..



    so , I basically installed API 10 in the android SDK removed Intel atom from its install.

    removed API 19 build tools (leaving 18.1, 18.1.1 22.3 and some older ones) left the rest of the 19 API stuff installed and untouched.

    deleted all my previous AVD's, via Android AVD manager

    I exited and restarted Processing a few times during this lot, but not sure when…. but I can now run devices on both my actual physical device and the Android emulator.

    it would be nice to be able to export a signed package now and for me to figure all the rest of this madness out.

    but this is fab!

    I think I'm now a Processing 2 convert and shall once again try to learn to code and also can now develop stuff for Android.

    cheers guys!

    so here's the links I found helpful to get everything running.

    Random repair, which led to sussing the intel atom bit.

    for checking the environment paths and setting them for the SDK on my mac etc.

    and of course, this Page :)

    SO I hope this helps somepeople as all your posts have helped me.

  • Hi; so the solution seems to be using 18.1.1 build tools! Anyway, do I need to uninstall ver 19 build tools? Is there a way I can specify which build tools to use, since I am using ver 19 for some other project? Thanks

  • Hi,

    I am still struggling with the Error BUILD FAILED /Applications/android-sdk-macosx/tools/ant/build.xml:892: The following error occurred while executing this line: /Applications/android-sdk-macosx/tools/ant/build.xml:894: The following error occurred while executing this line: /Applications/android-sdk-macosx/tools/ant/build.xml:906: The following error occurred while executing this line: /Applications/android-sdk-macosx/tools/ant/build.xml:283: null returned: 1

    If I go down to version 18.1.1 I'll get: /Applications/android-sdk-macosx/tools/ant/build.xml:483: The SDK Build Tools revision (18.1.1) is too low for project 'sketch_140628a'. Minimum required is 19.1.0

    How can I force to build with 18.1.1 ? Any ideas?


  • Hi,

    I'm a complete newbie. I registered to this forum just to tell, that I'm struggling for 3 days to get rid of this erroros. I'm facing the same problems like Monotask.

    Trying to compile a simple program give this errors:

    BUILD FAILED C:\Program Files (x86)\Android\android-studio\sdk\tools\ant\build.xml:892: The following error occurred while executing this line: C:\Program Files (x86)\Android\android-studio\sdk\tools\ant\build.xml:894: The following error occurred while executing this line: C:\Program Files (x86)\Android\android-studio\sdk\tools\ant\build.xml:906: The following error occurred while executing this line: C:\Program Files (x86)\Android\android-studio\sdk\tools\ant\build.xml:283: null returned: 1

    Total time: 8 seconds

    I've Googled so many pages, forums answers, without any success. Should it be really so hard to get things working, and make them intresting to newbies? Anyway, I find Processing as a friendly Java environment, and I'm looking forward with enhusiasm to make these things working.

    Thank you in advance for any suggestion.

  • Updating Android SDK tools to the latest version 23.0.1 solved the problem.


  • Same with me. The error of "Null returned: 1" showed and I fixed by updating Android SDK tools to the latest version 23.0.2 as well as platform & build tools to both 20

  • Just found this thread. Thanks for sending me in the right direction. My fix was similar to some of yours. I uninstalled Android SDK Build-tools 24rc1 (which was in the preview channel of the SDK manager) and replaced it with Build-tools 23.0.1.

Sign In or Register to comment.