Google+ Platform

Quick start for Android

This quick-start application is an Android project that lets you get started with the Google+ platform in about 10 minutes. The app demonstrates using the Google+ Sign-In button, using SDK methods to list people that the user has circled, and making requests to other Google APIs.

The Google+ platform for Android has the following requirements:

  • A physical device to use for developing and testing because Google Play services can only be installed on an emulator with an AVD that runs Google APIs platform based on Android 4.2.2 or higher.
  • The latest version of the Android SDK, including the SDK Tools component. The SDK is available from the Android SDK Manager.
  • Your project to compile against Android 2.3 (Gingerbread) or higher.
  • Eclipse configured to use Java 1.6
  • The Google Play Services SDK:
    1. Launch Eclipse and select Window > Android SDK Manager or run android from the command line.
    2. Scroll to the bottom of the package list and select Extras > Google Play services. The package is downloaded to your computer and installed in your SDK environment at <android-sdk-folder>/extras/google/google_play_services.

Step 1: Enable the Google+ API

To authenticate and communicate with the Google+ APIs, you must first register your digitally signed .apk file's public certificate in the Google APIs Console:

  1. In the Google APIs Console , create an API project for your application.
  2. In the Services pane, enable the Google+ API and any other APIs that your app requires.
  3. In the API Access pane, create an OAuth 2.0 client ID by clicking Create an OAuth 2.0 Client ID :
    1. Type a product name in the dialog box that displays, and click Next. Providing a product logo and home page URL are optional.
    2. Choose Installed application as your Application type and select Android as type.
    3. In the Package name field, enter the sample app's package name.
    4. In a terminal, run the the Keytool utility to get the SHA-1 fingerprint of the certificate. For the debug.keystore, the password is android.
      keytool -exportcert -alias androiddebugkey -keystore <path-to-debug-or-production-keystore> -list -v

      The Keytool prints the fingerprint to the shell. For example:

      $ keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v
      Enter keystore password: Type "android" if using debug.keystore
      Alias name: androiddebugkey
      Creation date: Aug 27, 2012
      Entry type: PrivateKeyEntry
      Certificate chain length: 1
      Owner: CN=Android Debug, O=Android, C=US
      Issuer: CN=Android Debug, O=Android, C=US
      Serial number: 503bd581
      Valid from: Mon Aug 27 13:16:01 PDT 2012 until: Wed Aug 20 13:16:01 PDT 2042
      Certificate fingerprints:
         MD5:  1B:2B:2D:37:E1:CE:06:8B:A0:F0:73:05:3C:A3:63:DD
         SHA1: D8:AA:43:97:59:EE:C5:95:26:6A:07:EE:1C:37:8E:F4:F0:C8:05:C8
         SHA256: F3:6F:98:51:9A:DF:C3:15:4E:48:4B:0F:91:E3:3C:6A:A0:97:DC:0A:3F:B2:D2:E1:FE:23:57:F5:EB:AC:13:30
         Signature algorithm name: SHA1withRSA
         Version: 3

      Copy the SHA1 hash, which is highlighted in the example above.

    5. Paste the SHA-1 fingerprint into the Signing certificate fingerprint field.
    6. To activate interactive posts, enable the Deep Linking option.

      Shows options in the Create Client ID dialog box.

    7. Click the Create client ID button.

Step 2: Run the Google+ sample app

  1. Clone or download the Android Quickstart Git repository.

    git clone
  2. Launch Eclipse.

  3. Select File > Import > Android > Existing Android Code Into Workspace and click Next.
  4. Select Browse.... Enter the path to your Android quickstart directory.
    Displays the Eclipse import project dialog with the quickstart project selected.
  5. Import the Google Play Services library project.
    1. Select File > Import > Android > Existing Android Code Into Workspace and click Next.
    2. Select Browse.... Enter <android-sdk-folder>/extras/google/google_play_services/.
    3. Select google-play-services_lib. Click Finish to import.
  6. Update the MainActivity project properties:
    1. Click Project > Properties. The project properties dialog displays.
    2. Select Android in the left navigation.
    3. Click Add... and select google-play-service_lib to add the Google Play Services library project dependency.
      Displays the Eclipse library dependencies dialog with Google Play
 services selected.
    4. Click OK.
  7. Connect your physical device to your machine by USB. Google Play Services requires a physical device and will not function on an emulator for Android platforms prior to 4.2.2.
    Connect your Android device to your computer to run the application on the physical device.
  8. Select Run > Run to test the quick-start sample app. Choose Android application and a physical device if prompted. The sample application will launch on your physical device.
    The Android sample
   app launches and allows you to try out the Google+ platform mobile features

Step 3: Verify that the project is configured correctly

Now that the sample app is running, you can verify that it is configured correctly by following these steps:

  1. In the sample app, click Sign in.
  2. If you have more than one account on your device, you should see a dialog to choose which account to use to sign in to the app.
  3. Choose an account and click OK.
  4. An authorization screen should display. If you do not see a screen that appears similar to the following screenshot, then your API console configuration does not match your running app. This is typically due to a mismatch between either the package ID or the SHA1 hash.

If the sample app did not run or you had problems, see the troubleshooting section. Otherwise, get started integrating Google+ with your app.


The authorization dialog did not display when running the sample app
  1. Verify that your package name matches the value that you entered in the APIs console. For the sample, the package name should be
  2. Verify that your SHA1 hash matches your API console project.
  3. Check that your debug.keystore file has not expired by examining the output of the keytool command. The line that begins "Valid from." If the keystore file is expired, delete the debug.keystore file and rebuild the app to create a new debug.keystore file. Run the keytool command again to generate a new SHA1 hash then create a new client ID with the new SHA1 hash.

Next steps

Now that you have run the sample app, you can integrate the GoogleApiClient to your Android activity:

Learn more about the Google+ features you can add to your app:

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.