Android SDK setup

Archived

This page has been archived and will receive no further updates.

Android Studio

Installing Android Studio

  1. Download Android Studio

    https://developer.android.com/sdk/index.html

  2. Unzip it

    unzip android-studio-ide-XXX.XXXXXXX-linux.zip
    
  3. Move it

    sudo mv android-studio /opt/google/
    
  4. Create an application launcher icon

    echo "[Desktop Entry]
    Type=Application
    Name=Android Studio
    Icon=/opt/google/android-studio/bin/studio.png
    Exec=/opt/google/android-studio/bin/studio.sh
    Terminal=false" >> ~/.local/share/applications/android-studio.desktop
    chmod +x ~/.local/share/applications/android-studio.desktop
    

Configuring Android Studio

  1. Go to File > Settings > Appearance & Behavior

    1. System Settings > Updates

      1. Automatically check updates for > Stable Channel
      2. Make sure Automatically check updates for is checked
    2. Appearance > Theme > Darcula

    3. OK

  2. File > Project Structure > SDK Location > JDK location

    1. Set to the version of Java you wish to use, for example:
      • /usr/lib/jvm/java-7-openjdk-amd64
      • /usr/lib/jvm/java-8-openjdk-amd64

Updating Android Studio

  1. Make sure update location is configured (see Configuring Android Studio above)

  2. Help > Check for Updates

    1. If it says Update and Restart, click that

    2. If it says Download, you must update manually:

      1. Exit Android Studio

      2. Go here: http://tools.android.com/download/studio/stable

      3. Click the latest version and download it

      4. Remove the old version of Android Studio (settings won’t be lost, they’re saved in ~/.AndroidStudioX.X)

        sudo rm -rf /opt/google/android-studio
        
      5. Use the same instructions above to unzip and move Android Studio

      6. Open Android Studio

      7. If you get the Complete Installation dialog, select I want to import my settings from a previous version > OK

      8. After upgrading, remove the old ~/.AndroidStudioX.X folder to free up space

  3. Install Android SDK updates

    1. Help > Check for Updates

    2. Click Update Now or Update for any updates

  4. Reconfigure Android Studio (see Configuring Android Studio above)

Common issues

Android SDK (old)

Installing the old SDK

  1. Install prerequisites for 64-bit Ubuntu:

    sudo apt-get install -y libc6:i386 libgcc1:i386 libstdc++6:i386 libz1:i386
    

    (http://askubuntu.com/a/498660/18665)

  2. Install Java

    sudo apt-get install -y openjdk-6-jdk openjdk-7-jdk
    
  3. Install Eclipse:

    Eclipse setup

  4. Download the latest Android SDK standalone tar file:

    http://developer.android.com/sdk/index.html

  5. Extract it

    tar xvf android-sdk_rX.X.X-linux.tgz
    
  6. Move it

    sudo mv android-sdk-linux /opt/google
    

When setting up the Android SDK, be sure to include the following packages:

  • Tools/Android SDK Tools
  • Tools/Android SDK Platform-tools
  • Tools/Android SDK Build-tools
    • Install the latest version
  • Under the latest API:
    • Documentation for Android SDK
      • This will be installed in /path/to/android-sdk-linux/docs
    • Sources for Android SDK
  • Under whichever API(s) you’re targeting:
    • SDK Platform
    • ARM EABI System Image
  • Extras/Android Support Library
    • Install this if you’re using Eclipse
  • Extras/Android Support Repository
    • Install this if you’re using Android Studio

Creating a new AVD (android virtual device)

  1. Open the AVD manager
  2. Click New…
  3. Under Target, select the version of Android you want the AVD to be
  4. For Name, name it HVGA_API_16 (using the API version you picked under target)
  5. Give it an SD Card size of at least 9 MiB
  6. Give it a device resolution of HVGA
  7. Click Create AVD

Showing Android SDK buttons in Eclipse

  • Window > Customize Perspective… > Command Groups Availability > Check Android SDK and AVD Manager