I decided to install the latest version of Eclipse, Indigo, and configure it to do Android application development. My specific final target is to build the VLC Player for Android. Below are my notes for installing such an Eclipse configuration for Android development on a clean Mac OS X Snow Leopard system.
Note: These instructions also work for the latest Eclipse Juno version. Just replace references to Indigo with Juno.
Install Android SDK
- Download latest Android SDK (I downloaded “android-sdk_r12-mac_x86.zip”).
- Unzip and move the extracted “android-sdk-mac_x86” directory to “/Applications”, so you end up with “/Applications/android-sdk-mac_x86”.
- Add the following to the end of your bash environment configuration file “~/.profile”. (The tilde symbol ~ translates into your home directory “/Users/your_username”.)
Some details on the above:
- Mac OS X Snow Leopard comes with the 64bit version of Java 1.6 installed by default. We are just setting the JAVA_HOME to point at it.
- The PATH is optional but will make it easy for you to run the Android SDK Manager by typing “android” or the Android Debug Bridge by typing “adb” in the Terminal.
- Set NO_NEON to prevent Android compilation from using the Neon CPU enhancements which are not supported on all Android devices (including the Emulator).
- Run the Android SDK Manager, by launching $ANDROID_SDK/tools/android, to install support for one or more Android OS platform versions. (It is mandatory that you install at least one OS platform version.)
- Click on “Installed packages” to see what is installed by default, usually just the Android SDK Tool and Platform-tools.
- Click on “Available packages”, expand “Android Repository”, and select the SDK Platform OS version that you want to develop for. For example, if you wish to do Honeycomb development (or your Android phone has Honeycomb), you can check “SDK Platform Android 3.0, API 11, revision 3”. You might wish to also get the samples by checking “Samples for SDK API 11, revision 1”.
Optionally, while we have the Android SDK Manager opened, you can create an emulator by clicking on “Virtual devices”:
- Click the “New…” button, name your emulator, select a platform OS version for the target, input a SD Card size like 32 or more, and hit the “Create AVD” button. The SD Card size is optional but some programs may fail to run if a SD Card is not present.
- Periodically, to update your installation, you may wish to go to “Installed packages” and click the “Update All…” button. This will return all updates (even for items not installed) which are applicable; you will need to select Reject for those items which you don’t want to install/update.
Install Android NDK
We will need the Android Native Development Kit (NDK) in order to compile the Android VLC JNI library:
- Download the latest Android NDK (I downloaded “android-ndk-r6-darwin-x86.tar.bz2”).
- Unzip and move the extracted “android-ndk-r6” directory to “/Applications”, so you end up with “/Applications/android-ndk-r6”.
- Edit “~/.profile” to add the following:
The PATH is optional but will make it easy for you to run “ndk-build” from a Terminal. Also, when compiling projects like VLC, the android prebuilt tool will be required to be in the path.
- Download the latest Eclipse.
- Select “Mac OS X (Cocoa)” in the “Packages for” drop-down listbox at the top to filter for only Mac versions.
- Find the Eclipse flavor you want. If you aren’t sure, I recommend getting “Eclipse IDE for Java Developers”. Click on the “Mac OS X 64 Bit” to the right to download. (I downloaded “eclipse-java-indigo-macosx-cocoa-x86_64.tar.gz”.)
- Unzip and copy the extracted “eclipse” directory to “/Applications”, so you will end up with “/Applications/eclipse”.
- Start Eclipse and select your workspace location. (If you select an old location which was used by an older version of Eclipse, make sure to delete the “.metadata” sub-directory there first; otherwise, your new Eclipse will display old plug-ins and IDE modes which it may not have installed.)
Change How Eclipse Handles Search Results
In the recent versions of Eclipse, the default behavior for search is to reuse the editor. This default behavior can be annoying because it prevents you from being able to simultaneously view more than one search result. Opening a new search result would reuse the editor tab and cause the previous search result to become unavailable. To configure Eclipse to open each search result in a new editor tab, do the following:
- Go to menu “Eclipse->Preferences->General->Search”.
- Uncheck the “Reuse editors to show matches” option.
Install Android Eclipse Plugin (ADT)
Add the ADT to Eclipse:
- Run Eclipse.
- Select Help->Install New Software…
- Input “https://dl-ssl.google.com/android/eclipse/” into the “Work with:” field. Hit Enter. The table below should populate automatically. (You can use the optional Add button if you want to bookmark this URL.)
- In the table, expand “Developer Tools” to see what it contains.
- Check the “Developer Tools” box to select all. (If you want just the minimum, check only “Android Development Tools”.)
- Click Next, Next, select “I accept the terms of the license agreements” radio button, and click Finish.
- If the Security Warning dialog about the “unsigned content” appears, click Ok to accept.
- Click on “Restart Now” to restart Eclipse.
Configure the ADT:
- Under Eclipse, go to menu Eclipse->Preferences.
- Select Android.
- In the “SDK Location”, browse to your android install directory (directory pointed at by $ANDROID_SDK or “/Applications/android-sdk-mac_x86”).
- Hit Apply and you should see the Android platform versions you installed earlier populate the table.
- Hit Ok to close the dialog.
- Go to Eclipse menu Help->Install New Software…
- Click on the dropdown arrow for the “Work with:” box and select “Indigo – http://download.eclipse.org/releases/indigo”. (If you don’t see this entry, just type in the URL manually.) The table will populate with a bunch of Indigo-compatible plugins.
- Click on “Restart Now” to restart Eclipse.
Optionally, add the PHP Development Tool (PDT) by repeating the steps above, filtering on “PHP” instead, and selecting “PHP Development Tools” for installation.
Install Subversion Eclipse Plugin (Subclipse) and Compile Android VLC Player
If interested, see the next post for instructions on installing the Subversion Eclipse Plugin (Subclipse) and compiling the VLC Player for Android.
Thanks man, you saved my day! 🙂