Android Studio

Android Studio is the new IDE (Integrated Development Environment) for Android, replacing Eclipse. See Meet Android Studio.

Install Android Studio 2.3.2
on Macintosh macOS Sierra 10.12.4

Installation on Microsoft Windows and Linux is similar.

  1. Make sure your Macintosh has at least version 1.8 of the JDK (Java Development Kit). To find what my Mac has, I opened the Terminal application and said
    javac -version
    javac 1.8.0_45
    
    and the Update section of the Java Control Panel in the Mac System Preferences says I have Java 8 Update 131. To update your Java, go to Java SE Downloads and press the big square button for Java Platform (JDK) 8u131. Accept the license agreement and select the .dmg (disk image) file for Mac OS X. On my Mac, the JDK was installed into the directory
    /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk

  2. Press the big green download button to download the Android Studio .dmg file to the Downloads folder on your Macintosh. (On PC, it’s a .exe file.)

  3. Follow steps 1–4 of the instructions for Install Android Studio. If this is the first time you are installing Android Studio, then you do not need to import any previous Android Studio settings.

    Android Studio Setup Wizard
    Choose the type of setup you want for Android Studio:
    • Standard
    Next
    Finish
    Downloading Components
    Finish

    When you’re done, you will see the “Welcome to Android Studio” window.

  4. Take a peek at the components you just downloaded. For example, to see which version(s) of the Android SDK you installed, launch the Terminal application on the Macintosh and type the following commands into the Terminal window. The tilde ~ stands for the full pathname of your home directory. The number 24 is an API level.
    cd ~/Library/Android/sdk/platforms
    pwd
    /Users/myname/Library/Android/sdk/platforms
    
    ls -l
    drwxr-xr-x  14 myname  mygroup  476 Jul 28  2016 android-24
    
    Why were the components placed in your directory ~/Library/Android/sdk? In the Android Studio welcome window, select
    Configure → Preferences → Appearance & Behavior → System Settings → Android SDK
    and look at the Android SDK Location.

  5. Tell Android Studio to write your Java import statements automatically for you. Pull down
    Android Studio → Preferences… → Editor → General → Auto Import → Java
    ☑ Optimize imports on the fly
    ☑ Add unambiguous imports on the fly
    Press the OK button.

  6. When we installed Android Studio, we also installed many command-line tools. You should place the names of the two directories that contain these tools into your PATH environment variable. Put the following export statement into the .bash_profile file in your home directory on your Mac. Each backslash must be the last character on its line.
    #Android SDK command-line tools
    
    export PATH=\
    ~/Library/Android/sdk/tools:\
    ~/Library/Android/sdk/platform-tools:\
    $PATH
    
    One way to find out if .bash_profile already exists, and to edit it if it does, is to launch the application TextEdit and pull down
    File → Open…
    Navigate to your home directory and type command-shift-dot to see all the files there, including the ones whose names start with a dot. After editing .bash_profile, change it to a plain text file:
    Format → Make Plain Text
    and save the file. Close the Terminal window (if it is open) and open a new one. See if you can run SDK tools such as adb and sqlite3 from the shell command line:
    echo $PATH
    echo $PATH | tr : '\n'
    
    which adb
    /Users/myname/Library/Android/sdk/platform-tools/adb
    
    adb version
    Android Debug Bridge version 1.0.39
    
    adb help
    
    which sqlite3
    /Users/myname/Library/Android/sdk/platform-tools/sqlite3
    
    sqlite3 -version
    3.16.2 2017-01-06 16:32:41 a65a62893ca8319e89e48b8a38cf8a59c69a8209
    
    sqlite3 -help
    Usage: sqlite3 [OPTIONS] FILENAME [SQL]
    etc.
    

Tutorial

Start looking at the apps we will do in class.