Then, after some battling, a victory. I finally got my friend Tim’s android app prototype working using the MacOS Android cmd-line dev tools. This was surprisingly non-trivial since the Google docs are somewhat scattered. Plus I had skipped through them. In retrospect, the eclipse plugin may have been easier, but the ol’ UNIX shell scripter in me wanted to “install from first principles” (-;
Anyway, here are my steps:
- Install the SDK
- Set your shell’s PATH variable to include the location to your $SDK_ROOT/tools folder.
- Important yet easy to miss (as I did): The installed SDK does not include the platform images for the various versions of the Android OS. You need to install these manually using the management app which comes with the SDK: Run the android app from the cmd-line, select “Available packages”, and download the SDK Platforms you need. I went with 2.3.3 for my friend’s app, I also got 1.6 which my prehistoric (3yo) original Google phone is limited to.
- From the command line, check the packages are available - android list targets. Keep this list handy.
- Then create Android virtual devices (AVDs) for each OS level you want to run in the emulator: android create avd -n testavd -t 1 [the -t flag corresponds to the ID listed by the previous 'list targets' command]. You can also create or view these devices in the “virtual devices” tab of the android GUI.
- Run the emulator! At last! emulator -avd testavd [I CTRL-Z into the background, go and have a cup of tea - its slow]
- When it finally loads, the emulator should look like an Android phone. Navigate to the Phone Settings, and make sure the following option is enabled: Settings > Applications > Unknown sources (enabled)
- cd to your $SDK_ROOT
- Load your app: platform-tools/adb install ./SECRET-ANDROID-APP.apk
- Bingo! If the app does not appear, try restarting the phone.
Next: django vs. Rails