Tools for building Android applications with Mirah
Ruby Mirah
Pull request Compare This branch is 1 commit ahead, 38 commits behind mirah:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A tool for writing Android applications in Mirah.

Pindah logo


You must have the Android SDK installed with the tools/ directory placed on your $PATH. Inside tools/, the android program will allow you to download "platform" packages corresponding with Android versions you wish to develop against. You'll need to install "Android SDK Platform tools" and at least one platform revision to get started. At the time of this writing, Android 2.1 (revision 7) covers over 94% of the market and is a reasonable target for new applications. Once the platform tools are installed, place the SDK's platform-tools/ directory on your $PATH as well.

You'll also need JRuby version 1.6 or higher installed with bin/ on your $PATH. If your gem and rake are not from from JRuby, prefix the gem and rake commands with jruby -S:

$ gem install pindah


The pindah executable will create a new project starting point given a package name. A package is a namespace for your code that is often derived from a domain name you own, but can be any hierarchical identifier as long as it's unique.

$ pindah create org.example.hello_world # optional path and activity name arguments

$ cd hello_world && tree
|-- AndroidManifest.xml
|-- libs
|-- Rakefile
|-- res
|   |-- drawable-hdpi
|   |   `-- ic_launcher.png
|   |-- drawable-ldpi
|   |   `-- ic_launcher.png
|   |-- drawable-mdpi
|   |   `-- ic_launcher.png
|   |-- layout
|   |   `-- main.xml
|   `-- values
|       `-- strings.xml
`-- src
    `-- org
        `-- example
            `-- hello_world
                `-- Start.mirah

12 directories, 8 files

The res/ directory contains application resources like icons, layout descriptions, and strings. The AndroidManifest.xml describes the contents and metadata of your application. The src directory contains the source code inside your package directory.

$ rake -T

rake clean      # Removes output files created by other targets.
rake compile    # Compiles project's .mirah files into .class files
rake debug      # Builds the application and signs it with a debug key.
rake install    # Installs/reinstalls the debug package onto a running     ...
rake javac      # Compiles and other gen/ files.
rake logcat     # Tail logs from a device or a device or emulator
rake release    # Builds the application.
rake spec       # Print the project spec
rake uninstall  # Uninstalls the application from a running emulator or dev...

$ rake debug

# [...]

$ ls -l bin/hello_world-debug.apk

-rw-r--r--   1 user           user        13222 Feb  7 23:16 bin/hello_world-debug.apk

This .apk file may be installed on a connected device or emulator with rake install. It may even distributed for users to install themselves, though stable versions should use the release task.

The official documentation has more details on building. The main difference between Pindah and the standard Ant build is that the Rakefile replaces build.xml as well as all the properties files. The page above also explains how to get an emulator running for testing your application.

See Garrett for an example of a basic project.


To contribute to Pindah, you need the required environment setup. You can get tests with the following set of commands.

$ git clone
$ bundle install
$ rake test


Problems? Suggestions? Bring them up on the Mirah mailing list or the #mirah IRC channel on freenode.

See Also

If Mirah is just too low-level and you need something more dynamic, you can try Ruboto, though be warned there is a very significant overhead it brings with it from JRuby's runtime.


Released under the Apache 2.0 license.

Copyright (c) 2011 Phil Hagelberg, Nick Plante, J.D. Huntington