From 7ea78c86d364ea558ff45a564ef6354fd4dd422f Mon Sep 17 00:00:00 2001
From: Scott Main 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:In this document
+
+
+
+
@@ -24,9 +42,12 @@ both phones and tablets.
To install the Google Play services SDK for development:
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.
+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.
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.
To set up a project to use the Google Play services SDK:
+Using Android Studio:
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.
+build.gradle file inside your application directory.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.
+
+in the toolbar.
<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.
+ + + +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.htmlTo 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