Tuesday 11 March 2014

Adding Google Play SDK in Eclipse

To develop an app using the Google Play Services API, you must download the Google Play services SDK using the SDK manager. I am making an assumption here that you have Eclipse installed and the Android Development Toolkit (ADT), if you don't stop reading and do so. Note that this article is for Android 2.3 or higher, if your developing for Froyo just stop!



Install the Google Play services SDK:

  1. Launch the SDK Manager in Eclipse select Window > Android SDK Manager.
  2. Scroll to the bottom of the package list, expand Extras, select Google Play services, and tick it. The Google Play services SDK is then saved in your Android SDK environment in <path_to_sdk/extras/google/google_play_services/.   
  3. Install a compatible version of the Google APIs platform. If you want to test your app on the emulator, expand the directory for Android 4.2.2 (API 17) or a higher version, select Google APIs, and install it. Then create a new AVD with Google APIs as the platform target.
  4. Make a copy of the Google Play services library project.Copy the library project at <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects.
  5. Import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.

To make the Google Play services APIs available to your app reference the library project you created in step 4 above.
After you've added the Google Play services library as a dependency for your app project, open your app's manifest file and add the following tag as a child of the <application> element:

Once your project references the library project, you can begin developing features with the Google Play services APIs like maps.

Google Play Services 4.2 has just been released and now includes support for developing for Chromecast and Google Drive.

Simples.

3 comments:

  1. Good read... Getting the google play SDK's was always tricky if you didn't know the right way of going about it

    ReplyDelete
  2. Very informative!

    ReplyDelete
  3. Good stuff man :) Helps stop those setup hiccups.

    ReplyDelete