Android Adventures, part 2
Based on the success of my previous post covering how I got my Android phone (Samsung Captivate) rooted, the “Scripting Language For Android” installed with Python, it was time to get Processing working on it.
Of course, it wouldn’t go easy or smoothly…
A. Install Processing For Android & Dependencies
Following the ‘Instructions‘ sections on the “Processing For Android” page, I installed:
- Java Development Kit (JDK)
- Android SDK (following their install directions)
- Latest version of Processing For Android (was 1.2)
B. Try Out Some Code
I started with these two tutorials, trying to walk through them to get the code working:
I immediately ran into problems…
C. Troubleshooting:
First problem:
Couldn’t get the Android emulator to run any of the example code. The first error I got started like this:
Importing rules file: tools\ant\ant_rules_r3.xml BUILD FAILED G:\android-sd\tools\ant\ant_rules_r3.xml:336: Error running javac.exe compiler
Websearching, I found someone else with the exact problem here. On that thread a fix was posted which linked here. Looking at that suggestion, I ended up doing these actions, which fixed the emulator problem:
- I added all of these dirs to my PATH system variable (Windows XP):
- C:\android-sdk-windows;
- C:\android-sdk-windows\tools;
- C:\Program Files\Java\jdk1.6.0_21\bin;
- I added a ‘ANDROID_SDK’ system variable, pointing it to ‘C:\android-sdk-windows’ dir.
- I had also previously added a ‘SDK_ROOT’ system variable pointing to ‘C:\android-sdk-windows\tools’ dir.
I should point out that maybe not all of those steps needed to be done, but after I did it all, I could finally get my sketches to load on the Android Emulator.
Second Problem:
When I tried to load the sketches on the phone itself via “Presentation Mode” in Processing, I got a new error:
“Device time out”
“Device killed or disconnected”
The computer wasn’t seeing the phone. In a nutshell: I had to switch the phone’s USB mode to “Enable USB Debugging”. By doing that, the computer once again failed to recognize the phone since the phone seemed to be in a ‘new usb mode’. Unplugging it and reconnecting it asked for me to reinstall the USB drivers again, twice in a row. But once the drivers updated, I was able to get the sketches loaded on the phone. Success!
D. Try Out Some Code (Again)
I was then able to go through both the above tutorials getting the code running on both the emulator, and on my phone itself. The examples are simple, but they look amazing on that screen.
I can’t wait to start writing some real code and getting it up on the phone. And I still need to figure out how to actually save it on the phone, and run it later… 😉
Update:
So, the next day I found out that Processing installs the sketches on the phone when you run them. I found them sitting in the Applications menu, named after the sketch that made them. I just hadn’t noticed when I initially loaded them. Nice!