I am getting error when i want to import google-play-service in Eclipse.
i have import google-play-service-project-lib in Eclipse
i have read all possible Q&A but nothing is work.
I have it added as Library and JAR manually
Then I have tried to clean my project ...
Is there anybody who can solve this problem?
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.
Firstly, try to download latest version of Google Play Services, then:
Remove the existing library to add again manually,
Go to your java build path,
Under project tab add your library and then,
Under order & export tab tick your library,
Apply settings.
After all, just clean the project and library, it should work.
By the way, you can also check this question.
To me it was just a matter of updating the dependencies.
dependencies {
implementation 'com.google.android.gms:play-services-ads:20.6.0'
}
I concluded that if it's already on the latest version, refresh the Gradle may solve the issue - or, as already recommended by Umit Kaya, remove the existing library and add it back.
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
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
I'm a beginner of Android Application development need to practice by examples and samples given in the book "Beginning with Android" by Wei Meng Lee, but whenever I try to follow those steps I come across a few errors unable to clean them. The Error seems like this:
" setContentView(R.layout.activity_main);" Don't know what type of error is it. In my computer I've installed SDK API level 16 that is for Android 4.1 What to do? Please guide me through appropriate answer.
Remove import
import android.R;
Than clean build your project also check xml layout file name in
setContentView(R.layout.activity_main);
than it'swork fine.
You should get the latest version of eclipse. Its now Eclipse Juno.
And check your import.
Remove
import android.R;
Instead put
import android.packagename.R;
Im using Eclipse Juno and ADT 20 v2 My Yamba app which has no errors forces close immediately it is launched
My Logcat shows me in the Yamba app
Could not find class "winterwell.jTwitter.Twitter" referenced from method com.marakana.yamba.StatusActivity.onCreate
I know many people here used Yamba to learn Android programming and d Oriellys site has no solutions
Is it the "Twitter("student","password") API root.." That is causing this?
I was able to solve this error by doing the following in Eclipse:
Project -> Properties -> Java Build Path -> Order and Export
then select "[x]jtwitter-yamba.jar - /path/to/jar"
Before it worked though, I had to do:
Project -> Clean...
Then ctrl-F11 to rebuild
Try using the latest version of normal JTwitter. I think it's compatible with Yamba. You need to call Twitter.setAPIRootUrl() to point it at Yamba instead of Twitter.