Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Google Play Services to Eclipse project

I've red a number of posts and articles but it's not working for me. I am not able to add/use the Google Play Services in my project.

My steps:

  1. I start a project which is using the Google Api's 2.2
  2. I have download the Google Play Services using the SDK
  3. I import the Google Play Services into my Eclipse workspace
  4. Adding Google Play Services as a dependency in my project: Project -> Properties -> Android -> Library, Add -> google-play-services_lib

Steps 1 till 3 are fine, but I think the problem is in step 4. Nothing happens after I do step 4, I'm not seeing any change in my Project structure: no library is added. These steps are also described here.

The reason I know it is not working is because any import from the Google Play Services is giving an unresolved error.

like image 758
BigJ Avatar asked Jan 17 '13 03:01

BigJ


People also ask

How do I import Google Play services?

To do this, select File > Import, and then select Android > Existing Android Code into Workspace, and browse to the google-play-services_lib project. After google-play-services_lib is successfully imported into your workspace, it needs to be marked as an Android library project.

What is Google Play Services API?

Google Play services powers a broad set of APIs and services on Android to help you build your app, enhance privacy and security, engage users, and grow your business. AdMob. Analytics.


2 Answers

I found that the play services libproject has to be imported onto the same physical drive as your project. (check the 'Copy projects into workspace' checkbox when you import)

like image 138
Owen B Avatar answered Oct 11 '22 07:10

Owen B


It took me 2 whole days to work out what was the problem, but now it is resolved.

The problem is with the 64 bit version of ADT and Java. Eclipse does not import libraries correctly with the 64 bit versions.

So I reinstalled Java 6 v 37 jdk (32 bit) and then downloaded the 32 bit version of ADT to go with it. I did this EVEN THOUGH I HAVE A 64 bit system

Anyway, I then followed the exact same procedure that had failed with the 64 bit versions. And it worked perfectly - first time.

So that is my advice - YOU MUST USE A 32 BIT VERSION OF JAVA AND ADT, because the 64 bit contains incompatibility issues with eclipse for importing the Google Play Services Library, and probably other libraries too.

PS. I followed the installation steps for Google Play Services outlined on developer.android.com

I should add that the develop.android site overlooks an important fact - that the map xml should be inside a linear or relative layout. It does not work unless it is inside a container layout such as these

like image 45
user3469294 Avatar answered Oct 11 '22 05:10

user3469294