AndroidDev

From 3DN

Jump to: navigation, search
This site is part of the 3DN Network. Every content on the 3DN Network is subject to the [3DN Terms of Service]. Other sites in the 3DN Network include: 3DN Politics 3DN Technology 3DN Voetbal 3DN Politicap and Dutchie

Contents

Android Development

On my laptop I've set up Eclipse and the Android Developer Kit so I can create Android applications. The custom papers recommended way to develop Android applications is making use of the Eclipse IDE. Having tried to set up Eclipse on both Ubuntu (my laptop) and Debian (my server) it's often been my experience that Eclipse versions are out of date, JVM versions are incessantly 'free' and don't quite work right with Eclipse etc. However, for the sake of demonstration I will try it again on my new server.

Eclipse

So I start off with simply:

fredl@omega:~$ sudo apt-get install eclipse

A whole slew of required packages get pulled in by Debian now. Starting up eclipse results in:

fredl@omega:~$ eclipse 
searching for compatible vm...
 testing /usr/lib/jvm/java-6-openjdk...not found
 testing /usr/lib/jvm/java-gcj...found

And a pop-up window saying 'This Eclipse build doesn't have support for the integrated browser. Clicking through on 'OK' shows the Eclipse 3.2 spash screen followed by a dialog to chose a workspace. Another messages is generated after chosing this workspace:

Could not create /usr/local/lib/eclipse/.eclipseextension. Please run as root:
   touch /usr/local/lib/eclipse/.eclipseextension
   chmod 2775 /usr/local/lib/eclipse/.eclipseextension
   chown root:staff /usr/local/lib/eclipse/.eclipseextension
/usr/lib/jvm/java-gcj/bin/java: symbol lookup error: /home/fredl/.eclipse/org.eclipse.platform_3.2.0/configuration 
/org.eclipse.osgi/bundles/92/1/.cp/libswt-mozilla-gtk-3236.so: undefined symbol: _ZN4nsID5ParseEPKc

After executing the touch/chmod/chown as root and restarting there's still the message about the undefined symbol. Swell! This may be because of the 'java-gcj' being used as a vm, so instead I pulled in the Sun Java 6 SDK:

fredl@omega:~$ sudo apt-get install sun-java6-jdk

After installing this, eclipse still doesn't find /usr/lib/jvm/java-6-openjdk. While reading the /usr/share/doc/sun-java6-jdk/README.alternatives the following command jumps out:

- Set all runtime and development tools to point to the sun-java6 alternatives:
 update-java-alternatives --set java-6-sun

Tried that, still no luck! Additionally... Eclipse is at version 3.5 by now and 3.5 is a recommended version for Android development.

So I simply removed the eclipse and eclipse-gcj packages and manually installed File:///download/software/eclipse-java-galileo-linux-gtk-x86 64.tar.gz Eclipse 3.5 instead. I untarred it in /usr/local and made a symlink from /usr/local/eclipse/eclipse to /usr/local/bin/eclipse. Works!

Android SDK

I also untarred the File:///download/software/android-sdk-linux x86-1.6 r1.tgz Android 1.6 r1 SDK in /usr/local.

Android plugin

Start up Eclipse, go into Help -> Install New Software, click on the 'Add' button to add a site, use name (for example) 'Google', Location https://dl-ssl.google.com/android/eclipse/. After the plugin is installed, go to Windows -> Preferences and select the right SDK path for Android. IMPORTANT: Make sure all files and directories are readable, the tar file comes with some pretty stupefying default permissions which will cause the plugin not to be able to read the ADT version.

After this we can go to File -> New -> Project -> Android Project and create a hello world project.

Personal tools
Google AdSense