From 7ea78c86d364ea558ff45a564ef6354fd4dd422f Mon Sep 17 00:00:00 2001 From: Scott Main Date: Wed, 6 Nov 2013 16:33:22 -0800 Subject: udpate gcore setup doc with info for android studio Change-Id: I3125d3b4d2c68fcb3ba281d0051e2acb5033a6f9 --- docs/html/google/play-services/setup.jd | 111 +++++++++++++++++++++++++------- docs/html/images/tools/sync-project.png | Bin 0 -> 880 bytes docs/html/tools/help/proguard.jd | 6 ++ 3 files changed, 94 insertions(+), 23 deletions(-) create mode 100644 docs/html/images/tools/sync-project.png diff --git a/docs/html/google/play-services/setup.jd b/docs/html/google/play-services/setup.jd index 6553c1840f90..fb656b748115 100644 --- a/docs/html/google/play-services/setup.jd +++ b/docs/html/google/play-services/setup.jd @@ -1,6 +1,24 @@ page.title=Set Up Google Play Services SDK @jd:body + + +
+ +
+ +

To develop an app using the Google Play services APIs, you must download the Google Play services SDK @@ -10,7 +28,7 @@ The download includes the client library and code samples.

To test your app when using the Google Play services SDK, you must use either:

@@ -24,9 +42,12 @@ both phones and tablets.

To install the Google Play services SDK for development:

    -
  1. Launch the SDK Manager. +
  2. Launch the SDK Manager in one of the following ways:
      -
    • From Eclipse (with ADT), +
    • In Android Studio, click SDK Manager + +in the toolbar.
    • +
    • In Eclipse (with ADT), select Window > Android SDK Manager.
    • On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
    • @@ -36,19 +57,25 @@ both phones and tablets.

    • Install the Google Play services SDK.

      Scroll to the bottom of the package list, expand Extras, select - Google Play services, and install it.

      + Google Play services, and install it. If you're using Android Studio, also install + Google Repository (it provides the Maven repository used for Gradle builds).

      The Google Play services SDK is saved in your Android SDK environment at <android-sdk>/extras/google/google_play_services/.

      + +

      Note: Google Play services 4.0.30 (released +November 2013) and newer versions require Android 2.3 or higher. If your app supports Android 2.2, +you can continue development with the Google Play services SDK, but must instead install +Google Play services for Froyo from the SDK Manager.

      +
    • 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.

      -

      Note: Only Android 4.2.2 and higher versions of the - Google APIs platform include Google Play services.

    • Make a copy of the Google Play services library project. +

      Note: If you are using Android Studio, skip this step.

      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. @@ -60,23 +87,59 @@ both phones and tablets.

      -

      Set Up a Project with the Library

      +

      Set Up a Project that Uses Google Play Services

      -

      To set up a project to use the Google Play services SDK:

      +

      Using Android Studio:

        -
      1. Reference the library project in your Android project. -

        See the - Referencing a Library Project for Eclipse - or Referencing a Library Project on the Command Line - for more information on how to do this.

        -

        Note: - You should be referencing a copy of the library that you copied to your development - workspace—you should not reference the library directly from the Android SDK directory.

        +
      2. Open the build.gradle file inside your application directory.
      3. +
      4. Add a new build rule under dependencies for the latest version of +play-services. For example: +
        +apply plugin: 'android'
        +...
        +
        +dependencies {
        +    compile 'com.android.support:appcompat-v7:+'
        +    compile 'com.google.android.gms:play-services:4.0.30'
        +}
        +
        +

        Be sure you update this version number each time Google Play services is updated.

        +
      5. +
      6. Save the changes and click Sync Project with Gradle Files + +in the toolbar.
      7. -
      8. If you are using ProGuard, add the following - lines in the <project_directory>/proguard-project.txt file - to prevent ProGuard from stripping away required classes: +
      + +

      You can now begin developing features with the +Google Play services APIs.

      + + +

      Using Eclipse or another IDE:

      + +

      To make the Google Play services APIs available to your app, you must reference the library +project you created in step 4 of the installation instructions.

      +

      See the Referencing a Library Project for Eclipse or Referencing a +Library Project on the Command Line for more information on how to do this.

      + +

      Note: +You should be referencing a copy of the library that you copied to your development +workspace—you should not reference the library directly from the Android SDK directory.

      + +

      Once you've set up your project to reference the library project, +you can begin developing features with the +Google Play services APIs.

      + + + +

      Create a Proguard Exception

      + +

      To prevent ProGuard from stripping away +required classes, add the following lines in the +<project_directory>/proguard-project.txt file:

       -keep class * extends java.util.ListResourceBundle {
           protected Object[][] getContents();
      @@ -95,11 +158,13 @@ both phones and tablets.

      public static final ** CREATOR; }
      + +

      Note: When using Android Studio, you must add Proguard +to your gradle.build file's build types. For more information, see the +Gradle Plugin User Guide.

-

Once you have the Google Play services library project added to your app project, -you can begin developing features with the -Google Play services APIs.

@@ -191,4 +256,4 @@ a user's device:

to display an error message to the user, which allows the user to download the APK from the Google Play Store or enable it in the device's system settings. - \ No newline at end of file + diff --git a/docs/html/images/tools/sync-project.png b/docs/html/images/tools/sync-project.png new file mode 100644 index 000000000000..09e183564208 Binary files /dev/null and b/docs/html/images/tools/sync-project.png differ diff --git a/docs/html/tools/help/proguard.jd b/docs/html/tools/help/proguard.jd index be0b8dc2b6a1..3ba7db271865 100644 --- a/docs/html/tools/help/proguard.jd +++ b/docs/html/tools/help/proguard.jd @@ -61,6 +61,12 @@ parent.link=index.html

To enable ProGuard so that it runs as part of an Ant or Eclipse build, set the proguard.config property in the <project_root>/project.properties file. The path can be an absolute path or a path relative to the project's root.

+ +

Note: When using Android Studio, you must add Proguard +to your gradle.build file's build types. For more information, see the +Gradle Plugin User Guide. +

If you left the proguard.cfg file in its default location (the project's root directory), you can specify its location like this:

-- 
cgit v1.2.3-59-g8ed1b