Sun Java SE 6First of all, you need Sun's Java development environment installed and running. It is readily packaged in pkgsrc (as Linux i386 binaries), in lang/sun-jdk6:
# cd /usr/pkgsrc/lang/sun-jdk6 [...]First, you'll have to accept both licenses of the JRE (runtime) and JDK (development) packages; to do so, add the following lines to /etc/mk.conf:
ACCEPTABLE_LICENSES+= sun-jre6-license ACCEPTABLE_LICENSES+= sun-jdk6-licenseThen, you'll have to download the generic Linux i386 packages yourself:
- jre-6u22-linux-i586.bin
- jdk-6u22-linux-i586.bin
Back to /usr/pkgsrc/lang/sun-jdk6, install it as usual:
# make install [...]This will install a complete Linux i386 binary emulation environment, if you didn't already have it installed (like for Adobe's Flash player). At this point, if the checksum of any file is wrong, then make sure to delete it and download it again: they are correctly referenced in pkgsrc, no need to insist.
Eclipse IDEThe next important thing is to obtain the Eclipse IDE (version 3.5 or earlier). An old version is already packaged in devel/eclipse (3.0.1), but it will certainly not be enough to get the SDK to work. The 3.6 Linux build of Eclipse ran perfectly though, as downloaded here: http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/helios/SR1/eclipse-java-helios-SR1-linux-gtk.tar.gz
It is then enough to extract and run the environment directly:
$ tar xzf eclipse-java-helios-SR1-linux-gtk.tar.gz $ cd eclipse $ ./eclipseCreate and choose a workspace directory as proposed, and you should then be greeted with the Eclipse welcome screen.
Android ADT plug-in for EclipseBefore installing the actual SDK for Android, it will greatly help if you get the "Android Development Tools" integrated into Eclipse. Select the Help menu, then "Install new software...". Click "Add..." to add the "ADT Plugin" repository at "https://dl-ssl.google.com/android/eclipse/" and "OK". "Select all" and hit "Next".
It's fine (so to speak) if it takes time at this stage: it just took ten minutes for me right now as I am testing this. So even if Eclipse seems to have hung, it seems that the first time you're doing this, it needs to (slowly) download, parse and refresh a whole lot of internal repository data before it even gets to the one you just added.
Anyway, just accept the license if you agree, go through the unsigned content, and restart Eclipse as proposed. If you're lucky (and patient) enough it will work eventually.
Android SDKYes, we're getting there. It is now time to download and extract the Android SDK as well:
$ ftp http://dl.google.com/android/android-sdk_r10-linux_x86.tgz $ tar xzf android-sdk_r10-linux_x86.tgzWith this done, you still have to let Eclipse know where you have extracted the tools: "Window" menu, "Preferences", in the "Android" tab simply browse to the SDK location, "Apply", "Apply" again (important) and "OK".
Do not hesitate to repeat this last step a few times, possibly restarting Eclipse right after doing it, as in my case it didn't seem to get it right the first or second time around.
Android SDK platformsThere is one last step and you'll be free to compile your first Android applications. In the "Window" menu, "Android SDK and AVD Manager": check and install the SDK platforms as needed. You'll then be ready to create and compile your first package, as documented there: http://developer.android.com/guide/tutorials/hello-world.html
Remaining challengesThere is still one thing that doesn't work on NetBSD with this setup: the emulator. It legitimately complains with this message:
/lib/libc.so.6: version `GLIBC_2.7' not found (required by .../android/android-sdk-linux_x86//tools/emulator)This is because the Linux emulation environment packaged is too old to support programs linked with newer versions of the glibc. As annoying as this is, there is good news: as far as I know, it is already supported in the -current branch of NetBSD's development, and will definitely be available in the 6.0 release.
ConclusionI have to say, in spite of the weight and very specific requirements of the SDK, it seems to be clearly documented and integrated. It's a good lesson for the more open development environments which I'm used to work with so far (like hackable:1, http://trac.hackable1.org/).
But unfortunately, again, if anything breaks, I did not find anything easier than to erase the whole "eclipse" folder and start over. It seems that programming complete IDE and SDK environments is too complex for developers to implement error checking: this has bitten me heavily when installing the SDK on Linux Debian 6.0 amd64:
- install the SDK without the i386 binary compatibility packages installed;
- everything seems to work, no errors, but it keeps forgetting where the SDK tools are, and then fails to create virtual devices;
- install the lib32ncurses5 i386 package (and dependencies)
- re-declare where the SDK tools are, it won't warn you again that they're missing but still won't work;
- start over from scratch, it will.
Yet:
$ file workspace/HelloWorld/bin/HelloWorld.apk workspace/HelloWorld/bin/HelloWorld.apk: Zip archive data, at least v2.0 to extractUpdate: I just packaged eclipse 3.6.1 in wip/eclipse. HTH :)



