Error in setting up google play services - android

I am trying to setup Google play services using their android-sample project.
I had successfully imported BaseGameUtils and also the google_play_services_lib . After that i imported the sample project Collect all the stars (and added the BaseGameUtils to its build target) to test it.
But It is giving me error ( -- cannot be resolved) on following two imports
import com.google.android.gms.appstate.AppStateClient;
import com.google.android.gms.appstate.OnStateLoadedListener;
I even try to import other example projects but they all are showing same error.
Below is a snapshot of error.

just restart the eclipse and it will build the work space. This helped to solve the issue.

I think your problem is with google Play services library project it is not updated
Remove Library From your Project after that open the sdk manager and downloads any update for Google Play Services
then import the google play services library project from the following path
..../sdk/extras/google/google_play_services/libproject/google-play-services_lib
to your workspace and build and add this project as a library project to your application project
after clean your application and build and run it should work.....

Related

import com.google.android.gms.location.ActivityRecognitionResult cannot be cannot be resolved

I was working on the latest Google API for detected activity. So Inorder to try that I download the sample code from
http://developer.android.com/training/location/activity-recognition.html
I imported the google-play-service-lib. have set it as a library for my project. I have also checked for required permissions, but I am still getting an error. I have also set target build to Google APIs
import com.google.android.gms.location.ActivityRecognitionResult cannot be cannot be resolved.
I was able to import other samples from google play services folder and they are running fine. Can anyone point out what error I am making ?
Ok I was able to fix it,....after reinstalling and adding and removing google play services for several times.
R u sure added the googleplayservices library if added check both are in same folder(path) are not by opening the project -> properties -> resource

Android error: Google play service version

I've this popular problem developing an android application with Eclipse:
error: Error: No resource found that matches the given name (at 'value' with value '#integer/
google_play_services_version').
So I've tried to import the google play library as specified here but I've this error:
Invalid project description.
C:\Users\Max\workspaceAndroid\google-play-services_lib overlaps the location of another project: 'google-play-services_lib'
Infact if I try to manage the libraries of the project I get this:
It seems that the google play libraries are already imported and I can't add new library.
The last chance I think I've is to add manually the string
compile 'com.google.android.gms:play-services:4.4.2#aar'
to my build.grade as specified in this answer but I don't know where find the file or if this will solve my problem.
How can I fix the error? Thanks!
Have you had the Google Play services installed already via the Google SDK Manager?
It looks like the following for me:
Here's what i did in the whole setup, to use the Google Maps Android V2 api
Google Maps API setup, Android V2 API
I had the same issue and was able to solve it by
Importing the google play services as an android project in eclipse
Adding reference to this imported project as a 'Lib' in
README.txt under google-play-services-lib reads like this;
Library Project including Google Play services client jar.
This can be used by an Android project to use the API's provided
by Google Play services.
There is technically no source, but the src folder is necessary to ensure that the build system works. >The content is actually located in the libs/ directory.
USAGE:
Make sure you import this Android library project into your IDE and set this project as a dependency.
Note that if you use proguard, you will want to include the options from proguard.txt in your configuration.

How To Import Google Play service in Eclipse ADT?

I use ADT Eclipse for Progrmming android.And Now I Want Use New Google APi for maps and use Google Play service.Now when Import Libary in Eclipse and added in my Project it's Error:
http://p30droid.com/Uploader/do.php?img=132
http://developer.android.com/google/play-services/maps.html
How to Resolve This Problem..thanks
The specific error you have at the moment is that you are missing a library project in your application project. At a guess - you may not have imported that library into your workspace or you may not have defined it as a library (you tick "is library" in the library project itself).

Android The import com.google cannot be resolved

I'm trying to test LocationService example of Android developer as per following link http://developer.android.com/training/location/retrieve-current.html. At that time, error message show me that "The import com.google cannot be resolved" for following 5 lines. I'm really confused how to solve this problem.
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
You will need the Google Play Services SDK configured within Eclipse and import google play services as library will dismiss this error .
There is a much simpler solution. In my case, I've gone through all the answers from a few sources and none of them give a straight answer to my problem. Finally, I found a sample app source code and when I import the source code I found out adding the library from Google Play Service Library directory solved it. Google Play Service Library is located (for windows user) here:
\sdk\extras\google\google_play_services\libproject
Import the library into Eclipse as a library project and add this library in your actual project will fix it.
EDIT: This guy made a great contribution on his tutorials how to use Android Google Map v2 step by step and very details. It also includes how to use with Android Support package’s backport of fragments.
http://ddewaele.github.io/GoogleMapsV2WithActionBarSherlock/part1
Assuming you use Eclipse.
Right-click on your project -> properties -> Android.
There use Google API's instead of standard Android.
If you're using Android Studio:
Right click on your app folder -> Open Module Settings -> Dependencies -> Click on the plus button -> Choose library dependency -> Search for "play-services" -> Double click on the com.google.android.gms:play-services
Press Ok and wait for Gradle to rebuild.
You can use this way. First of all close projects which are using google-play-services library. Whenever your mouse over the com.google.android.gms import that can not be resolved and towards the bottom of the popup menu, select the "Fix project setup" option as below. Then it'll prompt to import the google-play-services library.
If you're using Eclipse, you can fix this by installing Google Play Services SDK via the SDK Manager, load the google-play-services-lib project into Eclipse, and set this as a reference from your project. This is documented at http://developer.android.com/google/play-services/setup.html
Do you use android sdk with google api? If not, do that and it will work.
set your project properties to google api.
You will need the Google Play Services SDK configured within Eclipse.
Maybe useful for some other developers facing this error:
If you are changing to a newer Android Version and if you are using the android-support-library, you have to beware that all projects that you use as library also have the SAME version of the android-support-library. One example would be the actionbar-sherlock. ;)
It Works = Do you use android sdk with google api? If not, do that and it will work.
In project.properties I had to add the following (for ANT build):
android.library.reference.1=${root_prefix}/${sdk.dir}/extras/google/google_play_services/libproject/google-play-services_lib
If you are using Android studio you may be missing to add gradle to your project.
Add specific play service you want.
Here you may want to compile
com.google.android.gms:play-services-location:10.2.1
Add this to your build.gradle app module in dependencies.
In android studio,add dependency as follows:
In gradle script,go in build.gradle(Module:app) and add these lines
compile 'com.google.android.gms:play-services:10.0.1' in dependencies tag
Here 10.0.1 may be skipped or changed according to your library installed

Android Dependencies Issue

I am writing a MAP APP using Android Google Maps V2
But i am facing dependency problem, please see below images:
as you can see in above screen shot i am getting RedAlert Sign over Project Name
and as you can see in above screen shot getting RedCross over Android Dependencies
#ChulbulPandey
In Eclipse open Project -> Properties. Select Android on left. Check on the bottom that you have a reference to Google play services with a green checkmark. If not, click Add and add the google play services library
Path of google-play-services_lib at SDK;
\extras\google\google_play_services\libproject\google-play-services_lib
I am not sure but you can try this.
In Libraries tab remove the Google Maps V2 jar and add it again.
First, try changing project build target to something higher and then clean then build your project.
If that doesn't solve your issue then removing your external jar files linked and then import it again.
You must import google-play-services_lib library project from SDK and add a dependency to it from your project.
Path of google-play-services_lib at SDK;
\extras\google\google_play_services\libproject\google-play-services_lib
See link

Categories

Resources