Expert Android Studio. Dundar Onur

Expert Android Studio - Dundar Onur


Скачать книгу
want and complete the installation in the window shown in Figure 1.7.

Figure 1.6 Mac OS X Java installation

Figure 1.7 Java installation Max OS X

      Now JDK is ready to use on Mac OS X. You can check the installed JDK version from System Preferences of Mac OS X or type 'java –version' in the terminal window to see whether Java installed properly.

      Installing Java for Linux

      Two types of installation packages are available for Linux. If you use a distribution with an rpm package manager like Fedora, you can download the rpm package and install Java via rpm. In this section you install JDK with the tar.gz package on Ubuntu 14.04.

      1. Download jdk-7u79-x64.tar.gz from the download page shown in Figure 1.1 and extract it to the directory where you downloaded the tar.gz file using the following command:

      user@ubuntu$ tar xzvf jdk-7uXX-x64.tar.gz

      That command will extract JDK into the jdk1.7.0_79 folder where you ran the command.

      2. Move that folder to /usr/local/java with the following command:

      user@ubuntu$ mv jdk1.7.0_79 /usr/local/java

      3. Edit the /etc/profile file to set Java paths for your session. You can copy and paste the following lines to the end of the /etc/profile file.

      ##Java Path

      JAVA_HOME=/usr/local/java/jdk1.7.0_79

      JRE_HOME=$JAVA_HOME/jre

      PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

      export JAVA_HOM

      Eexport JRE_HOM

      Eexport PATH

      4. Install Java binaries for system-wide use with the following commands:

      • Install the Java binary:

      user@ubuntu$ sudo update-alternatives

      – install "/usr/bin/java" "java""/usr/local/java/jdk1.7.0_79/bin/java" 1

      • Install the Java Compiler binary javac:

      user@ubuntu$ sudo update-alternatives

      – install "/usr/bin/javac" "javac""/usr/local/java/jdk1.7.0_79/bin/javac" 1

      • Install the Java Web Start binary javaws:

      user@ubuntu$ sudo update-alternatives

      – install "/usr/bin/javaws" "javaws""/usr/local/java/jdk1.7.0_79/bin/javaws" 1

      5. Set Oracle Java as the default Java for your system with the following commands:

      user@ubuntu$ sudo update-alternatives – set java

      /usr/local/java/jdk1.7.0_79/bin/javauser@ubuntu$ sudo update-alternatives – set javac

      /usr/local/java/jdk1.7.0_79/bin/javacuser@ubuntu$ sudo update-alternatives – set javaws

      /usr/local/java/jdk1.7.0_79/bin/javaws

      When you are done with the previous instructions, JDK and JRE will be ready to use when you restart Ubuntu. You can test whether Java installed correctly with version control. The command and output for that will look like this:

      user@ubuntu~$ java – version

      java version "1.7.0_79"

      Java(TM) SE Runtime Environment (build 1.7.0_79-b15)

      Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

INSTALLING ANDROID STUDIO

      Android Studio installation, like Java installation, differs by operating system. The following sections provide installation instructions for Windows, Mac OS X, and Linux platforms.

      The direct link for the installation binaries is https://developer.android.com/sdk/index.html.

The download link that's available when you go to this site will be correct for the operating system you are running, as shown in Figure 1.8.

Figure 1.8 Android Studio download page

      NOTE

      Download options have installers bundled with Android SDK tools.

      Installing Android Studio for Microsoft Windows 10

      This section covers the installation instructions for Android Studio on Microsoft Windows 10.

      WARNING

      Make sure you are connected to Internet while you are installing the Android Studio because installation process includes downloading required Android SDK installation files from the web.

      1. Click the Download Android Studio for Windows link to download the latest Android Studio installer exe file.

      2. Run the exe file after the download completes. You will see the window shown in Figure 1.9.

      3. Click the Next button to select installation components. The Android Studio option can't be changed, but you can deselect the Android SDK, Emulator, and Intel HAXM installations, as shown in Figure 1.10.

      4. The next window prompts you for installation paths for Android Studio and Android SDK separately.

      5. As shown in Figure 1.11, the installation asks about Intel HAXM memory configuration, and lets you choose a custom memory configuration.

Figure 1.9 Android Studio Setup window

Figure 1.10 Android Studio Setup configuration for Windows

Figure 1.11 Intel HAXM configuration dialog for Windows

      TIP

      Recommended memory for HAXM is 2GB, but you can change that based on your hardware. We recommend that you install HAXM if you plan to use the emulator.

      HAXM is a hardware-assisted virtualization engine that lets you use your computer's processor to generate x86 Android images. Without HAXM, the emulator's performance will greatly suffer.

You are now ready to launch Android Studio on Windows. The first time you launch Android Studio, it asks you to select the theme for the IDE, as shown in Figure 1.12.

Figure 1.12 Android Studio theme selection on Windows

      Finally, the installation completes and Android Studio is ready to work on Android application projects.

      Installing Android Studio for Mac OS X

      This section covers the basic steps to install Android Studio on Mac OS X.

      1. From the page shown in Figure 1.8, click the Download Android Studio for MAC link.

      Download the android-studio-ide-141.2178183-mac.dmg


Скачать книгу