Monday, November 10, 2014

Setting up Android development environment with DevAssistant

If you have ever tried to set up your Eclipse IDE for Android development, you will probably agree with me that it is a tedious job. You need to:
  • install ADT plugin, but first you need to tell Eclipse about the 3rd party repository from where to install it
  • restart Eclipse
  • download SDK Tools and tell Eclipse where to find it
  • select additional Android SDK packages to install in SDK Manager
The process doesn't sound like a lot of fun, if you ask me. Of course there are other options. For example Google is working on IntelliJ IDEA based IDE called Android Studio, a dedicated IDE for Android development. It definitely sounds like an interesting project and I recommend to check it out. But on the other hand, I wonder how many developers used to Eclipse will eventually switch to this new IDE? You know, a habit is a shirt made of iron.
Nevertheless, back to what I originally wanted to share with you. You've probably heard of DevAssistant by now. In short, it's a tool which aims to help developers with setting up their development environment. And, as you've probably guessed, we can use this tool to automate the tedious process described above. So let's try it out.

First you need to enable additional Copr repository and install an RPM with Android assistant. You will also need to have package dnf-plugins-core installed in order to effectively work with Copr repositories.

# dnf install dnf-plugins-core
# dnf copr enable msrb/devassistant-android-eclipse
# dnf install devassistant-android-eclipse-assistant

Note the steps above will not be needed in a future, because DevAssistant will have its own repository for assistants (DAPI = DevAssistant Package Index).

Now we are ready to run DevAssistant itself:

$ da task android-eclipse --accept-sdk-license

Of course you can do this from GUI as well (just run "da-gui"), but I think that copy-pasting this one line is simpler and faster. DevAssistant will download and set everything up for you. This may take awhile, so it is an ideal coffee time.

When DevAssistant is done, you can open your Eclipse and start developing Android applications.

4 comments:

  1. What stuff does it download from the SDK Manager?

    ReplyDelete
    Replies
    1. Hi Sudhir,

      Currently it just calls:
      "android update sdk --filter tools,platform-tools,build-tools-$btversion,doc-21,android-21,extra-android-support,source-21,sys-img-x86_64-android-21,sys-img-x86-android-21 --all"

      So it should be pretty close to what SDK Manager offers to install by default when user opens it manually, minus Android TV system images.

      Of course user can install additional packages anytime later.

      Delete
    2. I suppose the script creates a hidden folder and un-archives everything there.

      I install eclipse-platform eclipse-cdt eclipse-emf-core eclipse-egit eclipse-jgit to get to as close to as offered by Android Bundle although this install a lot more than Android Bundle but Fedora doesn't really package stuff based on "Eclipse features". What eclipse packages are installed by the DevAssistant?

      Delete
    3. The location where to install SDK is configurable via "--path" argument, default is ~/android-sdks.

      Assistant installs these Eclipse packages: eclipse-emf, eclipse-cdt, eclipse-egit, eclipse-jgit, eclipse-platform, eclipse-jdt

      I read your e-mail on fedora-java ML and took inspiration from it :)

      Btw. you can see the script here:
      https://github.com/msrb/devassistant-android-eclipse/blob/master/assistants/task/android-eclipse.yaml

      Delete