The Maps Sample from Google Play Services

After struggling for two days, I finally have the Google maps sample from the Google Play Services as an SDK extra build and run successfully. The sample is available if you install the Google Play Services in the extras section from the Android SDK Manager. It should be located at the path, C:\adt-bundle-windows\sdk\extras\google\google_play_services\samples\maps.

The following are the critical parts to successfully build and run the sample:

  • Google Play Services Library: how to import and set reference to
  • Android Support Library: how to add the support library
  • Google Play Services on the client side: probably requested to upgrade
  • Physical Android device required to test the app: Android Virtual Device is not supported

The procedures to build and run the sample are summarized as follows:

  1. Import the maps code
    • Import>Existing Android Code Into Workspace
    • C:\adt-bundle-windows\sdk\extras\google\google_play_services\samples\maps
  2. Import the Google Play Service Library code
    • Be careful! it’s the LIBRARY support code, not the service itself
    • Import>Existing Android Code Into Workspace
    • C:\adt-bundle-windows\sdk\extras\google\google_play_services\libproject\google-play-services_lib
  3. Reference the Google Play Service Library project
    • Be careful! This is the most critical step. Open the maps Project properties page, choose the Android item in the list and add a Library reference at the bottom edge.
    • DO NOT be confused with the Java Build Path Libraries or the Project References.
  4. Add Android Support Library
    • simply copy them as static libraries into your project or
    • right-click on the project and choose from the context menu, Android Tools>Add Support Library
  5. Assign your key for Google Map Android API v2
    • DO NOT be confused with the Google Map API v2, which is for browser apps.
    • You gotta turn on Google Map Android API v2 service and create new Android key in the Google API Console
    • Assign your key in the AndroidManifest.xml.
  6. Test the app in a physical devices
    • You may be requested to upgrade the Google Play Services on your device.
    • Be careful! Android Virtual Devices are not supported this time.

GoogleApiConsole GoogleMapAndroidApiKey AndroidLibrary GooglePlayServices

About these ads

Tagged: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 200 other followers

%d bloggers like this: