You are here

Android Development with Scala, Eclipse, and Git on Debian Wheezy

Primary tabs

Over the past 24 hours I took a bit of a diversion from my normal routine and decided I wanted to try my hand at developing for Android using Scala. Having heard good things about the ADT, I also wanted to use Eclipse. Of course, a VCS is required for any development work, and I am most familiar with Git. I ran into a few issues, but they are resolved and things are working well now, so I figured I'd write the process up for others.

NB: I wrote a quick guide that is part of the Scala-IDE documentation. It overlaps somewhat with this guide, so it may be helpful to have both in separate windows / tabs.

What Debian provides

Java development tools for Eclipse. Android's API is Java-based, so this is essential. Pulls in dependencies for the eclipse core and all plug-ins / views / perspectives that will be useful for Java development.
Mylyn connector for Git. Mylyn integrates task and application lifestyle tracking into the Eclipse UI and this is required for it to understand Git repositories. As a dependency it pulls in the EGit tools which allow you to create, update, and navigate Git repositories from within Eclipse.
Scala language, core libraries, and core tools. Scala runs on the JVM and can trivially call (and be called by) Java. Yet, it's static type system is closer to Haskell's type system in expressiveness and conciseness and it is very easy to use lazy evaluation in it. On top of that, it's dynamic type system, reflection in particular, is best-in-class. Highly recommended for any project running on the JVM.

What we have to get elsewhere

Eclipse Web Standard Tools (WST)
This is available from the Eclipse release software updates repository, but doesn't seem to have made it into any Debian package. The ADT requires this, so we'll have to add that repository to Eclipse.
Android SDK and the Android Development Tools (ADT)
Not packaged for Debian. Also, I have had minor issues with license in the past. I'll ignore those for now, as an expediency issue.
Eclipse plug-ins / views / perspectives for Scala development. Couldn't find this in Debian; Eclipse basically has it's own package manager though, so it's not much of an issue.
The Eclipse plug-in that ties Android and Scala together and puts a nice bow on it. Scala development on Android was possible before this, but this makes things much nicer.

The process

  1. Using Apt or your favorite front-end install the packages we can get from Debian. I suggest installing most of the recommendations, too.
  2. Install the Android SDK. ( Your home directory is fine. Remember where it is though, you'll want to point the ADT at an existing SDK. Make sure you run (android sdk) after extracting the tarball; it should download additional binaries that later installs might need. (You can also install the APIs and system images you want.)
  3. Fire up Eclipse, creating a workspace if you don't have one or want a separate one for this type of development.
  4. Add some Eclipse software repositories. Either under Window -> Preferences -> Install/Update -> Available Software Sites or Help -> Install New Software... -> Add
    • Juno Release - - for the WST dependency of ADT
    • ADT Plugin -
    • Scala-IDE Nightly Juno - - The Eclipse in Wheezy is Juno, so we have to use the nightlies.
    • Android+Proguard+Scala -
  5. Install the ADT Plugin (; Install Scala-IDE (; restart Eclipse
  6. Install AndroidProguardScala; restart Eclipse
  7. Create or open your Android project
  8. Right-click the project
  9. Use Team -> Share to create a new repository or associate the project with an existing repository. Due to the way Eclipse or EGit works, a project must be a subdirectory in the repository, the project files can't be at the top-level.
  10. Use Scala -> Add Scala Nature to enable the use of the scala compiler and add the scala library to your dependencies. (If this adds a JRE dependency to your project, it can be removed.) After doing so, you'll like want to activate the Scala perspective, too.
  11. Use Add AdroidProguardScala Nature to integrate Proguard into the build process. This will reduce the size of the Scala library you ship in your Android package by only including the parts your program depends on. Highly recommended, without it you might even generate Android packages that are too large to be installed.