Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Android Google Maps

You're reading from   Learning Android Google Maps Integrate Google Maps with your Android application to offer feature-rich and interactive maps

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher Packt
ISBN-13 9781849698863
Length 356 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (13) Chapters Close

Preface 1. Setting Up the Development Environment 2. Configuring an API Key and Creating Our First Map Application FREE CHAPTER 3. Working with Different Map Types 4. Adding Information to Maps 5. Interacting with a Map 6. Working with Custom Views 7. Working with Location Data 8. Know about the Street View 9. Google Maps Intents 10. Creating a Custom Map Application A. Answers to Self-test Questions Index

Setting up Android Studio

In this section, you will learn how to set up the official Android Studio IDE on different desktop platforms.

Windows

Java Development Kit (JDK) is essential for the functioning of Android Studio.

  1. Download and install the latest version of JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Download the correct architecture, x86 for the 32-bit OS, as shown in the following screenshot:
    Windows

    The Oracle Java download page

  2. Next, install and configure Android Studio on your PC. Download the Android Studio bundle from http://developer.android.com/sdk/index.html.
  3. Run the downloaded executable and follow the onscreen instructions, as shown in the following screenshot:
    Windows
  4. Next, we will see the following screen:
    Windows

It may take some time for it to install. It may download some of the required components. Now, you have successfully installed Android Studio with SDK.

Mac OS X

We need JDK for Android Studio to work.

  1. Download JDK 7 for OS X from http://www.oracle.com/technetwork/java/javase/downloads/index.html.
  2. Open the downloaded .dmg file. A window will appear with a .pkg file. Double-click to launch the installer and follow the onscreen instructions:
    Mac OS X

    JDK 7 installation on Mac OS X

    Google recommends us to use JRE 6 for optimized font rendering. Similarly, download and install JRE 6.

  3. Next, download and install Android Studio.
  4. Download Android Studio for OS X from http://developer.android.com/sdk/index.html.
  5. Open the downloaded .dmg file. Drag and drop Android Studio in the Applications folder:
    Mac OS X

    Android Studio setup in Mac OS X

  6. Then, open Android Studio and continue with the setup process. Now, you have set up Android Studio on OS X.

Linux

Ubuntu is one of the most popular Linux distributions, which is based on Debian. Here, I am giving instructions to set up Android Studio in the Ubuntu distribution. The Ubuntu version I am using is version 14.10.

The first major requirement is the installation of Oracle Java. It is not available in the official Ubuntu PPA repository. So, we are going to download and install it from a third-party PPA repository.

  1. Open the Terminal or use the shortcut key Ctrl + Alt + T. Install Oracle Java 7 using the following commands. Enter it one by one:
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer
    
  2. You can install Oracle Java 8 by replacing the last command with the following:
    sudo apt-get install oracle-java8-installer
    
  3. Now, let's check whether we have setup Android Studio correctly. Enter the following command in the Terminal:
    java -version
    

    It should return an output similar to the following:

    java version "1.8.0_25"
    Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
    Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
    

    If you are using the 64-bit distribution of Ubuntu, you need to install some packages to get the 32-bit applications supported. If you are using version 13.10 or above, use these commands in the Terminal:

    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386
    

    For the earlier versions of Ubuntu, use the following command:

    sudo apt-get install ia32-libs
    
  4. Now, our initial setup is done. Download Android Studio for Linux from http://developer.android.com/sdk/index.html.
  5. Extract the downloaded ZIP package. Navigate to the android-studio/bin directory and execute the studio.sh shell script. Android Studio will start. Follow the onscreen instructions.

Now, you have set up Android Studio on Linux.

Setting up Eclipse with the ADT plugin

In this section, you will learn how to set up the Eclipse IDE with ADT on different desktop platforms.

Windows

The Oracle Java JDK is required for the functioning of Eclipse.

  1. Follow the same instructions given in the Setting up Android Studio section for installing Java. After installing Java, let's proceed to the next step.
  2. Next, we need to download the Eclipse IDE. Visit the following link and download the Eclipse IDE for Java developers: https://eclipse.org/downloads/index.php.
  3. Now, extract the downloaded ZIP package and run the eclipse.exe executable. Eclipse will be running. We need to set up SDK and download the Android SDK standalone installer from http://developer.android.com/sdk/index.html.
  4. Run the downloaded executable and follow the onscreen instructions.
  5. Set up the ADT plugin in Eclipse. Open Eclipse and select Help | Install New Software.
  6. A dialog box will appear. Enter the following URL and hit Enter: https://dl-ssl.google.com/android/eclipse/. Wait until it fetches information.
  7. Now, check the Developer Tools box and select Next. Accept the agreements and the ADT plugin will be downloaded and installed. Then, Eclipse will restart and ADT will be integrated with Eclipse successfully. Select Window | Preferences.
  8. Set the SDK location in the Android section. Hit Apply. Success! You have done it.

Mac OS X

Follow the same instructions given in the Setting up Android Studio section for Installing Java. After you have installed Java, proceed to the next step:

  1. Visit https://eclipse.org/downloads/index.php and download the OS X version of the Eclipse IDE for Java developers.
  2. Open the downloaded archive. Drag the eclipse folder to the Applications directory. To open Eclipse, open the Eclipse executable from the eclipse folder in the Applications directory. Next, we need to set up SDK. Download the Android SDK Tools standalone package for OS X from http://developer.android.com/sdk/index.html.
  3. Extract the downloaded SDK package. The ADT plugin setup is same as the setup on Windows. Now, you have set up Eclipse ADT with SDK on OS X.

Linux

Follow the same instructions given in the Setting up Android Studio section for Installing Java. After you have installed Java, proceed to the next step:

  1. Now, we need to download the Eclipse IDE. Visit https://eclipse.org/downloads/index.php and download the Linux version of the Eclipse IDE for Java developers.
  2. Extract the downloaded ZIP package and run the Eclipse executable. Eclipse will be running. Next, we need to set up SDK. Download the Android SDK Tools standalone package for Linux from http://developer.android.com/sdk/index.html.
  3. Extract the downloaded SDK package. The ADT plugin setup is same as the setup on Windows. Now, you have set up Eclipse ADT with SDK on Linux.

Downloading and setting up Google Play services

The Google Play services SDK is required to work with Google Maps. Google Play services can be only installed from the SDK Manager.

  1. Open the SDK Manager via Android Studio by selecting Tools | Android | SDK Manager.
  2. You can open the SDK Manager via Eclipse by selecting Window | SDK Manager.

    The following screenshot shows the Android SDK Manager:

    Downloading and setting up Google Play services

    Android SDK Manager

  3. Scroll down to the bottom. Under the Extras section, check Google Play services and select Install packages. The Google Play services package will then be downloaded and installed. If it is successfully installed, it will show the status as Installed.

Downloading the Google APIs System Image

We need the Google APIs System Image to test the Google Maps application on our PC. These system images have Google Play services preinstalled, which helps us test our Maps application. Open SDK Manager. Under each Android API section, you will find a Google APIs system image. You can use the ARM image or x86 image as per your own requirements. Now, select and install the system image.

Downloading the Google APIs System Image

Android SDK Manager

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image