22

Am trying to add google-play-service library in my project using import(For Google map). After adding the path am getting red X next to this reference and the reference is not adding . Know how to resolve this ?

Anil
  • 253
  • 1
  • 2
  • 8

9 Answers9

50

The red X means its a broken link path.

http://developer.android.com/google/play-services/setup.html

Copy the google-play services_lib library project to your workspace (folder where your android map project is). The library project can be found under the following path.

     <android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib library project .

Import the library project to your eclipse

Click File > Import, select Android > Existing Android Code into Workspace, and browse the workspace import the library project. You can check if it is library project. Right click on the library project. Goto properties. Click Android on the left panel. You will see Is Library checked.

Right click on your android project. Goto properties. Choose Android on the left panel. Click on Add and browse the library project. Select the same. Click ok and apply

enter image description here

Raghunandan
  • 132,755
  • 26
  • 225
  • 256
  • 1
    "Copy the google-play services_lib library project to your workspace (folder where your android map project is)." Can u please explain how to do this ? – Anil Jul 12 '13 at 09:10
  • 5
    you don't know how to copy paste from one folder to another?. – Raghunandan Jul 12 '13 at 09:11
  • 1
    When importing project in eclipse you have a checkbox, Copy project into workspace, select this. – user2138983 Jul 12 '13 at 09:13
  • @Raghunandan thnks .. :) am getting this error "android.view.InflateException: Binary XML file line #: Error inflating class fragment" while implementing google map any idea? – Anil Jul 12 '13 at 09:27
  • @Anil ask another question as its a different topic. Also post the relevant code (logcat details of the crash) and explain clearly. If not your question will be downvoted. I am sure the community will help you. – Raghunandan Jul 12 '13 at 09:29
  • @Anil also post the manifest file with xml layout activity code and stacktrace. I am sure your problem is solvable if you ask a new question. – Raghunandan Jul 12 '13 at 09:30
  • I'm using Titanium Studio and I don't have Android menu... some ideas? – ivy Nov 08 '13 at 14:00
  • @ivy no idea about `Titanium Studio`. – Raghunandan Nov 08 '13 at 14:01
  • You dont really have to copy this lib to your workspace, but if under windows make sure this lib location is on the same drive (same letter) as your project. – marcinj Feb 02 '15 at 18:57
  • @marcinj you should be using android studio. – Raghunandan Feb 04 '15 at 04:57
9

Eclipse does weird things when importing an existing project (google-play-services-lib), especially if you try to import and then allow the project to be automatically 'copied' to your workspace. I had the same issue and here is how I fixed it:

  • Close Eclipse

  • Erase all google-play-services projects from your workspace

  • Manually copy the google-play-services-lib folder (....sdk\extras\google\google_play_services\libproject\google-play-services_lib) into your workspace

  • Open Eclipse

  • Add a new project, choosing 'Existing Android Project', then navigate to your workspace and add the newly copied google-play-services-lib project

  • Finally, add the google-play-services-lib to your project as a library (just like you normally would)

Hope this helps! :)

Machine Tribe
  • 871
  • 9
  • 13
4

Though it's over a year for this question but never the less thought of putting it down here. Might help some one facing a similar issue.

While doing a File -> Import one probably might have selected the folder,

C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\ 

instead of

C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\libproject\google-play-services_lib

Quite strange as Eclipse did not correctly copy the google-play-services_lib project in my workspace, but this caused a cross mark to appear in my Project Properties.

Dan
  • 2,701
  • 1
  • 29
  • 34
TechnoBrat
  • 277
  • 1
  • 7
1

got a perfect solution for your question. this problem is due to improper referencing of library projects. You need follow these step.

  1. create a new project
  2. copy all the java files from src of your previous project in which you are getting error to the new project you have created just now.
  3. Also copy layouts xml files.
  4. now import play services you will not get this error.
Sébastien
  • 11,860
  • 11
  • 58
  • 78
praveen
  • 11
  • 1
1

I was also getting same problem.

I copied google library folder into work space and import now it's working fine.

shubham bansal
  • 796
  • 1
  • 5
  • 13
0

Try to place the Google-play-service library with in your same working Directory by coping the files from Click File > Import, select Android > Existing Android Code into Work space, and browse the work space import the library project.

vinay Maneti
  • 1,447
  • 1
  • 23
  • 31
0

You add Project in to your workspace. Start Eclipse and import project one option is ther copy to workspace do it. After that add google play services it also copy in to your work space and add it your library hope so its working.

MIkka Marmik
  • 1,101
  • 11
  • 29
0

This is common issue Youur google-play-service-lib project and your android project should be inside the same folder For example if your Android Appplication name is MyMap is in D:/workspace t hen your play service lib project should be in the same directory D:/workspace

Abhijit Chakra
  • 3,201
  • 37
  • 66
0

Close Eclipse. Delete

.metadata

and

.recommaditions

folders from your workplace. Import your projects back.

resw67
  • 139
  • 3
  • 6