So good stuff – some peeps are getting their processing apps on to Android. Now I did this on a Windows 8 System with Processing 2.09b with the latest Android bundle SDK. Getting the emulator to run is a bit of a trek – but it does work.
1 – Make sure Processing is running as Admin – especially if you are on Windows Vista, 7 or 8. Its easy go to the exe file and right click – you should see Run as Administrator – that will help a lot let me tell you.
2 – Make sure you set the emulator port to 5554 or whatever it comes up as – if you dont do this it wont work
3 – Always use Sketch -> Run in emulator. If you dont – it keeps trying to run it in the actual device and you need to kill all sorts of Java processes to make it work. Pain
All I can say is dont give up – it will work and work well. Writing apps for Android on Processing is simply brilliant and its a brilliant way to learn.
So with that in mind – there are some things you need to do:
First out – read this
http://wiki.processing.org/w/Android. Its got some good examples. You will also need the Ketai library if you want to use the sensors for accelerometer etc.
Now I would just install the full bundle. If you are doing it on Windows – then install the full bundle unzip it and move the bundle to somewhere like c:\dev\bundlename – just makes it easier in my view. It also would be good to see eclipse which is a more advanced development tool and maybe you can use that as well.
I put my in c:\android – so now I have:
Go in there and click on SDK Manager.exe – that launches the manager – you need to now load API 10. Its easy. Also need to load The Google USB driver – you need this to install on an actual phone!
So you want this: API 10 and the USB Driver
Install these items
Now I would suggest creating your own emulator device. Mobile developers use emulators for most of their work. Essentially an emulator is a phone that run ins software. Most modern PCs are so powerful they can emulate the entire hardware of your mobile phone as an app. So thats what we want to do. I will show you how to download to Android device later.
So if you look at the SDK manager you will see a Tools menu at the top. Select Manage AVD – Android Virtual Device. Now you create the phone you want to emulate.
You should see this:
Click new and create a device – you will get the idea. You can see I already created a tablet and a nexus.
Rock and Roll ready to Go
So that should work. Now start processing – load up a simple sketch – no library – just to keep it simple.
So when you run Processing – set the mode to Android – top right Corner – default is Java – select Android – you will see a dialog asking for the SDK – good.
Navigate to the location – where you put the bundle. In my case
Now from processing – click on Android Tab – then AVD Manager. Click the emulator you created and click Start
All being well – you will see this:
Note the number at the top – 5554 here – yours should say that.
Run one instances of processing go to File -> Preferences
You should see at the bottom – a preferences file location – note it and click it – shut down processing now as it will save to that file when it shuts down.
My file is located here:
C:\Users\dave\AppData\Roaming\Processing\preferences.txt – so you can edit that with notepad if you need to as well.
Open the file – and you should see the first line:
Change it to the number on the actual emulator:
Save it and restart
You can now run the app in the emulator. I used the AndroidClock Sketch – it uses an image which looks neat. The sketch can be downloaded from here:
and it should look like this on the emulator. Pretty cool.