6

My current wokspace setup looks like this:

enter image description here enter image description here

However, people have told me that to get maps working, I also need to have "google-play-services_lib.jar" in my "Android Dependencies" folder, and the way to do that was through doing: "to Google Play Services into your project Project -> Properties -> Android -> Library, Add -> google-play-services_lib"

The only problem with that is it always after the initial green marker, it turns to a red cross when re-opening "Project -> Properties -> Android -> Library" ...and also no "google-play-services_lib.jar" gets added to "Android Dependencies" in the prooject

This question is an off-spring of this: Trying to get maps v2 Android demo working where I was told above was necessary to get maps working in my app. (Otherwise one gets error during inflating the XML containing the maps fragment.)

Community
  • 1
  • 1
Tom
  • 3,587
  • 9
  • 69
  • 124
  • Maybe a dupe. Try: http://stackoverflow.com/questions/14371725/add-google-play-services-to-eclipse-project – alanjds Jul 22 '13 at 18:09

2 Answers2

4

Have you tried to use Google APIs instead of Android 4.2.2? Using that will use Google Maps dependencies.


I just made a "working app" (it throws no errors but I was too lazy to make a key) using Google Maps v2 and not Google APIs as build but Android 4.1. This was my procedure.

  1. Download the library from the SDK download manager.
  2. Copied the folder "google-play-services_lib" which had this path ".../android-sdk/extras/google/google_play_services/libproject/google-play-services_lib" to another folder where I keep my libraries.
  3. In Eclipse I chose New Project - Android Project from Existing Code. It got imported without any problems.
  4. Right click the test project, click Properties - Android - Add - google-play-services_lib which now is in my workspace.
  5. See if it works by trying to subclass com.google.android.gms.maps.MapFragment.

Please respond if you get any errors, if you do it right it will all work. Good luck.

Simon Zettervall
  • 1,764
  • 1
  • 15
  • 31
  • 1
    Have you done a full clean? Project - Clean - Clean all. Also open error log and see what is generating the error. – Simon Zettervall Mar 11 '13 at 15:56
  • Do you mean error log? I have that in the linked SO in my question. However, the conclusion in that SO is that Google-Play-Services is not installed correctly causing the error. – Tom Mar 12 '13 at 19:51
  • Cleaning all project did not move "google-play-services_lib.jar" into my "Android Dependencies". – Tom Mar 12 '13 at 19:53
  • 1
    @Tom Make a new test project and see if that works, pretty sure your current project is bugged. All I can say so far. – Simon Zettervall Mar 13 '13 at 09:02
  • If you see the maptest project in my workspace, that is a pure demo I copied "char-by-char" from demo project found online... (I have been through a couple) That also did not work (same problem) – Tom Mar 13 '13 at 11:24
  • Just checked some old projects of mine and I do not need the jar you are talking about, is it specific for Google Maps v2? I use the deprecated Google Maps 1 and I only need to choose Google APIs. – Simon Zettervall Mar 13 '13 at 14:32
  • Google maps v1 are not available any longer. (And yes, you need Google Play Services) – Tom Mar 13 '13 at 15:39
  • I just tried: File | New | Android Application Project. I chose 4.1 where I could and 4.2 other places. I then tried to import Google-Play-Services (located in its original location). That went like always, initial green / no problems. But when reopening the dialog, there's a red cross like shown in screenshot two. Do you think it will help move the Google-Play-Services library? – Tom Mar 13 '13 at 18:18
  • I am very frustrated right now and very happy. It actually worked moving the lib. Everything done the same otherwise. Lib just placed in another location... And it now stays green... I am... very annoyed at **undefined entity** right now, but very happy problem appears solved. (I will just spend the next hour checking it really is so.) – Tom Mar 13 '13 at 18:24
  • I appear to get blank screen with [+] [-] buttons (I guess that could indicate a separate problem with API key), I consider the problem described in this SO solved. Thanks Simon, and everyone else who contributed here or other places, for finally bringing me onwards! :) – Tom Mar 13 '13 at 18:57
  • 1
    @Tom I am glad it worked! I am not sure on which OS you are on but I am on Linux and if I do not move stuff to my home directory (I develop as a regular user of course) it will often not work because of permission problems. – Simon Zettervall Mar 14 '13 at 10:19
  • I am on Windows. This is the first time I have ever had a problem with an IDE and/or Eclipse where its default placements of files won't work. (And I do not think it was a permission issue since there **to my knowlegde** are no differences regarding that with the two placements.) Anyhow, I actually got maps up and running now finishing up on adding markers and other stuff, so things are finally progressing again :) – Tom Mar 14 '13 at 11:45
  • 1
    @Tom Yeah I cannot understand why it started throwing errors. Oh well, good luck with your outstanding app! – Simon Zettervall Mar 14 '13 at 13:25
0

First you need to delete your google-play-services project from your Package Explorer then you need to copy "google-play-service folder" from the directory C:/android-sdks.....google-play-service to your WORKSPACE then open Eclipse import the project "google-play-services" also from your WORKSPACE and then you can add the library...

Hope it helps:)