- Learning Android Google Maps
- Raj Amal W.
- 404字
- 2021-07-09 21:54:30
Configuring Google Play services
Google Play services include the classes required for our map application. So, it is required to set it up properly. It differs for Eclipse with the ADT plugin and Gradle-based Android Studio. Let's take a look at both separately. It will be simple.
Android Studio
Configuring Google Play services with Android Studio is very simple. You need to add a line of code to your build.gradle
file, which contains the Gradle build
script required to build our project. There are two build.gradle
files. You must add the code to the inner app
folder's build.gradle
file. The following screenshot shows the structure of the project:

The code should be added to the second Gradle build file that contains our app module's configuration. Add the following code to the dependencies in the Gradle build file:
compile 'com.google.android.gms:play-services:7.5.0
The structure will be similar to the following code:
dependencies { compile 'com.google.android.gms:play-services:7.5.0' compile 'com.android.support:appcompat-v7:21.0.3' }
The 7.5.0
in the code is the version number of Google Play services. Change the version number according to your current version. The current version can be found from the values.xml
file present in the res/values
directory of the Google Play services library project.
The newest version of Google Play services can be referred to from https://developers.google.com/android/guides/setup.
That's it. Now resync your project. You can sync it like this: Tools | Android | Sync Project with Gradle files.
Now, Google Play services will be integrated with your project.
Eclipse
Let's take a look at how to configure Google Play services in Eclipse with the ADT plugin. First, we need to import Google Play services into the workspace. Then, select File | Import.
The following window will appear:

In this window, select Android | Existing Android Code Into Workspace.
Then, select Next. In the next window, browse the sdk/extras/google/google_play_services/libproject/google-play-services_lib
directory. It is given in the following image:

Finally, select Finish. Now google-play-services_lib
will be added to your workspace. Now, let's take a look at how to configure Google Play services with our application project. First, select your project. Then, right click on | Properties.
In the Library section, select the following: Add | google-play-services_lib.
Next, select OK; google-play-services_lib
will be added as a library to our application project. The following screenshot shows this:

In the next section, we will take a look at how to configure an API key and add permissions that will help us to deploy our application.
- iOS Game Programming Cookbook
- HTML5+CSS3王者歸來
- Cocos2d-x游戲開發:手把手教你Lua語言的編程方法
- Python自動化運維快速入門
- INSTANT Sencha Touch
- Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API
- 快速念咒:MySQL入門指南與進階實戰
- 精通MATLAB(第3版)
- Integrating Facebook iOS SDK with Your Application
- Swift 4從零到精通iOS開發
- Learning Hadoop 2
- JavaScript程序設計(第2版)
- Machine Learning With Go
- Python Machine Learning Blueprints:Intuitive data projects you can relate to
- Building Microservices with Go