How to Add Google Play Services to Your Project – Part 1

Below are the steps to integrate Google Play services to your project. First step is to install the Services SDK to Eclipse, second is to integrate this to our application.

Step 1

Install Google Play Services To Eclipse

1. Launch the SDK Manager SDKMAnagerIcon

Select Window > Android SDK Manager.

2. Scroll to Bottom of the list and make sure Google play services is installed. Otherwise select the package and install it.


GooglePlayServices

Step 2

Integrate Google Play Services To Our Application

Note: Play services is a library project so we have to import the project to our workplace.

1. We need to copy the library project from the SDK Location.

For that first go to Eclipse – Window > Preferences Select “Android” tab from top left corner. At the top, we can see the SDK LocationOpen that location in your Windows Explorer Or from Finder in your MAC machine. Once you open the SDK folder go to the following location /extras/google/google_play_services/libproject/. Then copy the folder google-play-services_lib. (This is the folder which needs to be imported)

2.Paste. Two options

Option a: As we are working as groups under different version controls like SVN, git, mercurial etc. The general practice I followed is to add this(copied folder – google-play-services_lib) to one of our locations in our version control and checkout it to our local machine.

Option b: Simply paste the google-play-services_lib folder to any of your location say workplace.

3. We then import the folder from Step 2

File > Import, select Android > Existing Android Code into Workspace

Note: The below method is not right File > Import, select General> Existing Projects into Workspace

4. Refer the Google Play services library project to our Application.

Select your project (not the Google Play services Library Project), then right click on it. Select Properties > Select Android tab from top left corner > In the Library Section Press Add Select google-play-services_lib project and press OK. You can see a green tick in the Library Section left to Google Play Service Library if everything is done right.



AddPlayServcies

In the next part we will deal with ‘how to handle Google Play services not installed in the device’ condition and implement sample Map Apis and may be GCM.

Source: Setup Play Services

21 thoughts on “How to Add Google Play Services to Your Project – Part 1

  1. Pingback: Android Novice – Unable to build android project? | Suslov Babu
    • Paste google services folder in any location in your my computer (eg: G:\Android\Projects in windows or Users//Documents/Projects)…. Then import that project to eclipse as in Step 2 explained (File > Import, select Android > Existing Android Code into Workspace)

      Like

  2. greyshack : I also faced the same problem , the solution that worked for me was like this :

    Solution :

    Error : First -> I got a red exclamation mark as u had got
    Solution : I restarted the eclipse
    Solved

    Next, after removal of that mark when i tries adding it to my project I got the error of the project not opening because it was missing the “.project file” , i tried copying it from the folder to the project in eclipse but of no use
    Solution : I deleted it and imported it again
    Solved

    Please let me know if this helped you

    Like

  3. hello, help me please…
    after imported google lay service then the values of google play service are error. how to fix them ? the message is :
    google-play-services_lib\res\values-zu\strings.xml:18: error: Resource entry common_google_play_services_unsupported_title is already defined.
    [2014-11-11 17:38:22 – TampilPeta] D:\Androidku\google-play-services_lib\res\values-zu\common_strings.xml:26: Originally defined here.
    [2014-11-11 17:38:22 – TampilPeta] D:\Androidku\google-play-services_lib\res\values-zu\strings.xml:19: error: Resource entry common_google_play_services_unsupported_text is already defined.
    [2014-11-11 17:38:22 – TampilPeta] D:\Androidku\google-play-services_lib\res\values-zu\common_strings.xml:27: Originally defined here.

    Like

  4. thanks for it 🙂
    after it i want to generate gradle file for android studio so i m exporting the project . in that when i select project it shows error like this.
    Project../google_play_services/libproject/google_play_services_lib is missing. Needed by LocationDistanceTimeMapV2

    Liked by 1 person

    • Hi Dharmishtha,

      Google play services library project will not be needed anymore in the case of android studio. Please do the below

      1. Remove the play services library project dependency in gradle file (we dont need to link to library project anymore in android studio)
      2. Remove the play services library project folder
      3.Add the play services dependency just like in this link https://developers.google.com/android/guides/setup .

      Hope this helps.

      Cheers

      Like

Leave a reply to Suslov Babu Cancel reply