Installation

An Android app is written using the Eclipse application on your Mac or PC. Then you copy the app onto your Android phone or tablet. This document tells you how to install Eclipse on your Mac or PC.

  1. Make sure your computer has Java. If Java is missing from either platform, get it from Oracle. I pressed the square button under Java SE Downloads that said Download Java Platform (JDK) 8u25.
  2. Eclipse is an IDE (integrated development environment) analogous to the Macintosh Xcode. Android suggests that you create a directory named $HOME/Development to hold your Eclipse; see ¶ 1 in Install the SDK and Eclipse IDE. On Mac, one way to create this directory is by opening the Terminal application and saying the following. The permission bits 700 stand for rwx------, to agree with your other subdirectories.
    cd
    pwd
    mkdir Development
    chmod 700 Development
    ls -ld Development
    
  3. Press the big blue “Download Eclipse ADT” button to download Eclipse. (For my Windows Toshiba Qosmio X505, I selected 64-bit.) The resulting file adt-bundle-<os_platform>-yyyymmdd.zip also contains Eclipse’s Android ADT plugin. On Mac, the <os_platform> is mac-x86_64; on Windows, it’s windows-x86_64. The yyyymmdd of the current Android is 20140702.
  4. Take a moment to look at what you just installed on your Mac or PC. The directory
    $HOME/Development/adt-bundle-<os_platform>-20140702/sdk/platforms/android-20
    contains the current version of Android. Later, we can pull down the “Android SDK Manager” in the Window menu of Eclipse and install other versions of Android.
  5. When we installed the ADT, two of the directories we created were named
    $HOME/Development/adt-bundle-<os_platform>-yyyymmdd/sdk/tools
    $HOME/Development/adt-bundle-<os_platform>-yyyymmdd/sdk/platform-tools
    These directories contain programs that we will run from the command line. Append the names of these directories to your PATH environment variable. You should now be able to run command line programs such as the following in the Macintosh Terminal window or the Microsoft Windows Command Prompt window. The program lint is in the tools directory; adb is in platform-tools. (You may already have another copy of lint on your Mac or PC.)
    lint --version
    No Java runtime present, requesting install.  (If this happens, go back to step 1 and install Java.)
    lint --help
    
    adb version
    adb help
    
  6. You’ll probably want to drag the executable Eclipse application into the Macintosh dock, or make a Desktop alias (Mac) or shortcut (Windows) for it.
  7. Launch Eclipse. The workspace directory is where Eclipse saves your projects. Accept the workspace directory it offers you.
    Send usage statistics to Google?
    • No
    Finish
  8. A system image is necessary to create the AVD in step 9. Install one or two system images. After you have launched Eclipse, select
    Window → Android SDK Manager
    Check the checkboxes for the system images
    Tools → Android 4.4W API 20 → Android Wear ARM EABI v7A System Image
    Tools → Android 4.4W API 20 → Android Wear Intel x86 Atom System Image
    You can uncheck all the other checkboxes except for
    Extras → Android Support Library
    If you plan run the Intel x86 system image in Eclipse on a Mac, you should also check
    Extras → Intel x86 Emulator Accelerator (HAXM Installer).
    Press the Install n Packages… button. In the next window that pops up, highlight
    ▼ Android SDK License
    • Accept License
    Press the Install button. When the system images have finished being installed, quit Eclipse and restart it.
  9. If you plan to run the Intel x86 system image in Eclipse on a Mac, open a Terminal window and give the following command as the superuser. (The command avoids the “VT/NX Not Enabled” error message. See this article.)
    nvram boot-args='kext-dev-mode=1'
    nvram boot-args     (to make sure it worked)
    
    Reboot the Mac. Go to the directory
    $HOME/Development/adt-bundle--yyyymmdd/sdk/extras/intel/Hardware_Accelerated_Execution_Manager
    and double-click on the file IntelHAXM_1.1.0_for_10.10.dmg (or below_10.10). Then double-click on the .mpkg carton to run the HAXM installer. Accept the defaults for RAM allocation and install location.
  10. An AVD (Android Virtual Device) is a simulator that displays a picture of an Android phone on the screen of your Mac or PC. in Eclipse, create an AVD by selecting
    Window → Android Virtual Device Manager → Android Virtual Devices
    Press Create….
    AVD Name: avd
    Device: 3.7" WVGA (Nexus One) (480 × 800: hdpi) or whatever you want
    Target: Android 4.4W - API Level 20 (the W stands for Wear)
    CPI/ABI: Android Wear Intel Atom (x86)
    Skin: Skin with dynamic hardware controls
    OK
    Now select your new AVD in the Android Virtual Device Manager window and press the Start… and Launch buttons. It takes a minute or two for the AVD to launch itself.
    To see all your apps, touch the circle.
    You should see the app icons, including the Settings app.

    The AVD has a habit of dimming down every few seconds. To prevent this, open the AVD’s Settings app and select
    device → Display → Sleep
    and select “after 30 minutes of inactivity”.

  11. If you’re a serious Unix person accustomed to pipes and grep, you will eventually want to install Busybox into your AVD. But don’t worry about it now.
  12. To copy an app from your Mac or PC to your Android device, it may be necessary to create and edit a .ini initialization file on the Mac, or install a device driver on the PC. We’ll cross this bridge when we come to it.