Google Play Services Dependency - android

When I open my app, it is supposed to take me to the login page for Google or email. It runs me to the main screen and says update Google Play Services. I am not sure why this is happening when I am running the latest version -
compile 'com.google.android.gms:play-services-auth:11.0.0'
I switched to just the auth in order to avoid transitive dependency issues. It was not working with the regular gps dependency.
It isn't my code because I have been doing a tutorial..I've checked.
My project builds, but I would like the services to work :-)

In your project level build.gradle add
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
}

Related

Android Studio cannot find Firebase

I'm trying to get the Android P preview setup, and in the process I am upgrading all my dependencies, but it gets mad when Firebase and Google Play Services don't match versions. (It wont build). The latest version of Google Play Services is 15.0.1 as denoted here. The latest version of Firebase is version 16.0.0, according to this page. So I figured I should use 15.0.1 for all of them. However Android Studio can't seem to resolve any version of Firebase. It always gives me an error like this:
It gives the same error for any version I give it.
Here are my dependencies:
implementation 'com.google.firebase:firebase-core:15.0.1'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
Try to update firebase like below:
implementation 'com.google.firebase:firebase-core:16.0.0'
Also make sure that you use latest google service:
classpath 'com.google.gms:google-services:4.0.1'
From docs you are linked to you can find annotation
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
The firebase-core library wasn't released at version 15.0.1. You can see via http://maven.google.com that you should use either 15.0.2 or 16.0.0 (my suggestion is to always use 16+ libraries when they exist b/c we're removing version ranges from the POM files (therefore, you'll go back to hermetic builds). The May 23rd entry of our release notes goes into more details, if needed. (https://developers.google.com/android/guides/releases)
The assumption that all of the libraries should be used at the same version is no longer valid as of versions 15.0.0 and greater. Libraries will continue to release independently and with ever-diverging version numbers (following a SemVer.org scheme).

Issue with google service plugin and databinding

I was using databinding in my project. Then I want to use Firebase so I added google service plugin in my project
classpath com.google.gms:google-services:3.3.1
after this... my project cannot compile with the error:
Cannot change dependencies of configuration :app:api after it has been included in dependency resolution.
if I disable databinding.. or remove google service plugin, this error will be gone.
I still want to use databinding.. help!!
Just realize this is a known issue. no solution for now.
Need to disable google service plugin for now
https://issuetracker.google.com/issues/79122163
The error has disappeared after updating to
classpath 'com.google.gms:google-services:4.0.1'

Regarding the update of gms-play-services appindexing to 10.2.0 in Android studio

I was trying to update my Google Play services app indexing to 10.2.0 and I updated the compile line in my dependencies of build.gradle as shown in the image as compile "com.google.android.gms:play-services-appindexing:10.2.0" but I am facing an error as shown in the image as "Failed to resolve: com.google.android.gms:play-services-appindexing:10.2.0".
I even tried the install repository link but it didn't work.
I had the same issue.
App indexing has moved from Play Services to Firebase.
You need to delete the line
compile 'com.google.android.gms:play-services-appindexing:10.2.0'
since this lib does not exist, you already have app indexing in your dependencies here:
compile 'com.google.firebase:firebase-appindexing:10.2.0'

GooglePlayServices is not working with the project

I am working on a project where I have to authenticate a user with the Google plus and I did that. Now I have shifted my project from one PC to another for some reasons. I have made changes on developers console but when I try to login with google plus after launching, it says "Google Play Services not available. This application will close."
Why this error comes when everything is fine?
gradle dependencies is as follows:
dependencies {
compile 'com.android.support:support-v4:+'
compile 'com.google.code.gson:gson:1.7'
compile 'com.google.android.gms:play-services:+'
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
Make sure that the device (or the emulator) where you're running the app has Google Play Services installed with the latest version (currently at least 8.1.0), or set exact (earlier) version in your build.gradle.

What is the best way to add Google Play Service dependencies on Android Studio?

I have added Google Play Service dependencies to Android Studio.
I want something that works today and in the near future, something that keeps my app code up to date, without having to worry about every new Play service release, if possible.
Currently, I have this:
dependencies {
compile 'com.google.android.gms:play-services:7.5.0'
}
Is this the best way to add Google Play Service dependencies on Android?
You can use the following to always build against the latest available Google Play Services version:
compile 'com.google.android.gms:play-services:+'
However you will get a warning from Android Studio indicating that your builds are potentially non-repeatable and your code may break at any time (and you may not know why) due to changing versions behind the scenes. It's a trade-off. For a little more control you can use one of these:
compile 'com.google.android.gms:play-services:7.+'
compile 'com.google.android.gms:play-services:7.5.+'

Categories

Resources