Cannot resolve symbol 'GooglePlayServicesClient' - android

I am trying to migrate a project from Eclipse to Android Studio, the project can be build in Eclipse and was successful imported to Android Studio, however, I get Cannot resolve symbol 'GooglePlayServicesClient' error in Android Studio.
I followed the official tutorial to imported Google Play service in Android Studio, and an other package "com.google.android.gms.common.ConnectionResult" that used in my project does not have same issue. Only 'GooglePlayServicesClient' cannot be resolved.
I have also tried clean and rebuild my project, but the problem persists. What am I doing wrong?
Update:
My build.gradle
...
dependencies {
compile project(':libraryListViewAnimations')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services:7.0.0'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/commons-net-3.1-sources.jar')
compile files('libs/commons-net-3.1.jar')
compile files('libs/mail.jar')
}

GooglePlayServicesClient is obsolete and no longer included in the Google Play Services 7.x library. Google recommends using the GoogleApiClient instead.
See Accessing Google APIs in the Android developer docs:
"Note: If you have an existing app that connects to Google Play services with a subclass of GooglePlayServicesClient, you should migrate to GoogleApiClient as soon as possible."

Did you add compile 'com.google.android.gms:play-services:7.0.0' to build.gradle?
You can find more guide here . Hope this help.

Related

How can I create own gradle dependency in android studio?

For developing android applications by using Android Studio, generally we add dependencies in build.gradle instead of adding jars or libraries.
Example given below
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
How can i create own gradle dependency in android studio?
You have to publish your library on JCenter. You can find steps of publishing it on Google.

Firebase Error cannot access zzanb after using play-services-xxx:9.8.00

I got the below message when I use newest version of com.google.android.gms:play-services-xxx:9.8.00
Error:(32, 28) error: cannot access zzanb
class file for com.google.android.gms.internal.zzanb not found
The error was caused by invoking statement:
FirebaseAuth.getInstance().getCurrentUser().getUid();
How can I fix this problem?
Thank you.
UPDATE: Problem was solved
The newest updated of firebase version 9.8.0 is compatible with the google-service version 9.8.0. Now, everything works correctly.
NOTE: Firebase and Google Play Sevice always have same version. #see Ian Barber's comment below.
9.8.0 was an accidental early release. Please don't use it! If you happened to update your Android tools over the weekend of October 22-23, you may have accidentally received this update. To remove it, simply uninstall and reinstall the Google Repository tool.
I had such a similar error when i was recently upgrading my play service dependency. It seems to occur when you leave out updating the firebase dependencies that correspond to the version of play services you use.
Here is what the two versions of my dependencies were:
Error version of dependencies
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.firebaseui:firebase-ui-database:1.0.1'
compile 'com.google.firebase:firebase-storage:9.8.0'
Working version of dependencies
``
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.0'
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.firebaseui:firebase-ui-database:1.0.1'
compile 'com.google.firebase:firebase-storage:10.0.0'
``
Google seems to move play service updates along with firebase updates these days. Hopes this saves a few souls out there.
There is a tricky inconsistency in the build.gradle(Module App) warnings that can lead to this error. I had all my play-services compiles:
compile 'com.google.android.gms:play-services-drive:9.6.1'
compile 'com.google.android.gms:play-services-plus:9.6.1'
--- etc ---
grayed out, with a note that a newer version, namely 9.8.0, was available after I upgraded various Google Play apks. After changing all the play-services compiles to 9.8.0:
compile 'com.google.android.gms:play-services-drive:9.8.0'
compile 'com.google.android.gms:play-services-plus:9.8.0'
---etc---
I got the weird error:
class file for com.google.android.gms.internal.zzanb not found
in attempting to compile my code. The tricky thing was all my firebase compiles:
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-invites:9.6.1'
---etc---
were NOT grayed out, so I neglected to upgrade those compiles at the same time as I upgraded the play-services compiles. Upgrading all the firebase compiles to 9.8.0:
compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.google.firebase:firebase-invites:9.8.0'
--- etc ---
fixed the error.
Also, the warnings in the monitor when you get this error suggest depressing 'deprecation' and 'unchecked' lint warnings. That is unnecessary and doesn't fix it.
Android Studio should gray out both the firebase and play-services compiles together to avoid this error, particularly as the error message is so cryptic and the lint warning suppression suggestions don't work.
Finally, I get back to com.google.android.gms:play-services-xxx:9.6.1.
I guest that the problem occur because of the difference between firebase version and gms version. Currently, Firebase run on version 9.6.1

Android Eclipse project having Google+ and Facebook login when imported to Android Studio does not work. Login functionality fails

I have an Android project created in Eclipse which uses google play services and Facebook sdk libraries to login through google+ and Facebook. When I import this project to Android Studio and generate an apk, the google+ and Facebook login do not work.
They work fine in the apk generated by Eclipse however. I am not sure what causes this problem, the way use google services has changed in Android Studio and it just requires adding a dependency instead of adding the library. I searched this topic but could not find someone with the same problem. I need to know what changes to make in the project so it works properly.
Any help is highly appreciated.
Current dependencies in the imported project.
dependencies {
compile project(':facebookSDK')
compile project(':googleplayservices_lib')
compile project(':dateTimePickerMaterialLibrary')
compile 'com.google.code.gson:gson:2.4'
compile 'joda-time:joda-time:2.9.2'
compile files('libs/android-async-http-1.4.4.jar')
compile files('libs/universal-image-loader-1.9.4.jar')
}

cannot resolve mixpanel - after migrating to Android Studio

I tried migrating to Android Studio. When I use mixpanel project as library it works,but when I delete that folder and instead add in the build.gradle :
compile 'com.mixpanel.android:mixpanel-android:4.+'
compile 'com.google.android.gms:play-services:3.1+'
it doesn't work , and says
import com.mixpanel.android.mpmetrics.MixpanelAPI;
cannot resolve symbol mixpanel.
compile 'com.mixpanel.android:mixpanel-android:4.+'
change to
compile 'com.mixpanel.android:mixpanel-android:4.9.1'
worked for me

The import com.google.android.gms.common.GooglePlayServicesClient [duplicate]

I am trying to migrate a project from Eclipse to Android Studio, the project can be build in Eclipse and was successful imported to Android Studio, however, I get Cannot resolve symbol 'GooglePlayServicesClient' error in Android Studio.
I followed the official tutorial to imported Google Play service in Android Studio, and an other package "com.google.android.gms.common.ConnectionResult" that used in my project does not have same issue. Only 'GooglePlayServicesClient' cannot be resolved.
I have also tried clean and rebuild my project, but the problem persists. What am I doing wrong?
Update:
My build.gradle
...
dependencies {
compile project(':libraryListViewAnimations')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services:7.0.0'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/commons-net-3.1-sources.jar')
compile files('libs/commons-net-3.1.jar')
compile files('libs/mail.jar')
}
GooglePlayServicesClient is obsolete and no longer included in the Google Play Services 7.x library. Google recommends using the GoogleApiClient instead.
See Accessing Google APIs in the Android developer docs:
"Note: If you have an existing app that connects to Google Play services with a subclass of GooglePlayServicesClient, you should migrate to GoogleApiClient as soon as possible."
Did you add compile 'com.google.android.gms:play-services:7.0.0' to build.gradle?
You can find more guide here . Hope this help.

Categories

Resources