Wednesday, March 20, 2013

Android on FreeBSD

I have been doing Android development on and off for about 12 months now and since I don't run Linux, Windows or OS X anywhere I've had to resort to using VBox and X11 forwarding.
VirtualBox, although fantastic with what it does, is still not fast enough and I've found the more I code, the more frustrated I get with the poor performance of my setup.
Unfortunately there's no native Android SDK for FreeBSD, but thanks to the FreeBSD linuxulator we can get some near-native performance with the Android SDK.for Linux

I've decided to ditch the recommended IDE ( Eclipse ) and go with  IntelliJ ( http://www.jetbrains.com/idea/ ) -- it comes highly recommended by many Java developers and seems a lot less 'buggy' than Eclipse. Luckily for me it's written in java and runs quite happily on FreeBSD 9.1 with java/linux-sun-jdk16, I have tried a few other Java versions, but this one seems to work the best.


Here's a pic of JB 4.2.2 running with IntelliJ 12.0.4 (Community Version).



There are two things that aren't working quite the way they should.
IntelliJ is calling the 64bit emulator binary, instead of the 32, and this isn't executable by the linuxulator as it only supports 32bit bins. I have worked around this by linking the 64bit bin to the 32bit.

ADB also isn't working through IntelliJ. I haven't quite figured out why this is, but watch this space - I'll post an update when I figure it out. Until then it's ant and adb from CLI!


$ ant debug
Buildfile: /home/ash/IdeaProjects/untitled2/build.xml
-set-mode-check:
-set-debug-files:
-check-env:
 [checkenv] Android SDK Tools Revision 21.1.0
 [checkenv] Installed at /home/ash/adt-bundle-linux-x86-20130219/sdk
...
debug:,
BUILD SUCCESSFUL
Total time: 4 seconds

$ ~/adt-bundle-linux-x86-20130219/sdk/platform-tools/adb devices
List of devices attached
emulator-5554   device
$ ~/adt-bundle-linux-x86-20130219/sdk/platform-tools/adb install *.apk
1787 KB/s (36918 bytes in 0.020s)
        pkg: /data/local/tmp/untitled2-debug-unaligned.apk
Success


*EDIT: Seems changing over to OpenJDK6 has fixed the 'adb' connectivity  issues

No comments: