Could not find com.google.android.gms:play-services:3.1.59 3.2.25 4.0.30 4.1.32 4.2.40 4.2.42 4.3.23 4.4.52 5.0.77 5.0.89 5.2.08 6.1.11 6.1.71 6.5.87
Check if you also installed the "Google Repository". If not, you also have to install the "Google Repository" in your SDK Manager.
Also be aware that there might be 2 SDK installations - one coming from AndroidStudio and one you might have installed. Better consolidate this to one installation - this is a common pitfall - that you have it installed in one installation but it fails when you build with the other installation.
Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0)
Make sure you have google()
repository in project-level build.gradle before any others:
allprojects {
repositories {
google()
mavenLocal()
jcenter()
}
}
Could not find com.google.android.gms:play-services-base Required by Project React Native Maps
Before running the run-android
run command, navigate to the android directory and enter ./gradlew clean
command. After that enter the run-android
command again.
Could not find com.google.android.gms:play-services-analytics:8.1.0
Open the Android Studio SDK manager, make sure all of your build tools are up to date. Then make sure your Google Play Services and Google Repository packages are up to date. In the Android Studio sdk manager, you'll find these under the "SDK Tools" tab. If you are using the standalone sdk manager, you would scroll down to the "Extras" section at the bottom and update them there.
How to fix google play service error
One of your dependency is having different version of com.google.android.gms
.
Update
Firebase dependencies are having independent versions unlike past. If
you have version conflicts then you can update your
com.google.gms:google-services
. and start defining independent
version.
Update com.google.gms:google-services
Go to top (project) level build.gradle and update
com.google.gms:google-services
to version4.1.0
or newer if available.
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.1.0' //< update this
}
}
Update Firebase dependencies to Latest Versions
Firebase dependency versions can be individual. So check Latest Versions.
com.google.firebase:firebase-core:16.0.3 //Analytics
com.google.firebase:firebase-database:16.0.2 //Realtime Database
Orignal Solution (Useful)
Ways to resolve:
- Exclude
com.google.android.gms
from conflicted dependency. - Update that dependency if available.
- Change your
com.google.android.gms
version as conflicted version.
Problem
how to see which dependency is using com.google.android.gms
?
1. Solution by command
For Android, use this line
gradle app:dependencies
or if you have a gradle wrapper:
./gradlew app:dependencies
where app
is your project module.
Additionally, if you want to check if something is compile
vs. testCompile
vs androidTestCompile
dependency as well as what is pulling it in:
./gradlew :app:dependencyInsight --configuration compile --dependency <name>
./gradlew :app:dependencyInsight --configuration testCompile --dependency <name>
./gradlew :app:dependencyInsight --configuration androidTestCompile --dependency <name>
2 Use these plugins
Gradle View is an Android Studio plugin that you can install and show dependency hierarchy.
Methods Count is another plugin, it also shows dependency tree.
Flutter error : Could not resolve com.google.android.gms:play-services-location:16.+, Status code 502
All my codes were right, the only problem was the location package which I replaced with geolocator package. Now it's working fine.
Flutter exception Could not resolve com.google.android.gms:play-services-location:16.+
In an attempt to emulate the application one more time, before displaying the error on the terminal it showed me the following message: "Plugin project :location_web not found. Please update settings.gradle." and I found that in my project the error was caused by the location package, which has a dependency on location_web
Solution
That said, until they fix the problem, the solution is not to use the "location" package and replace it with one that doesn't have this location_web dependency. I did it using the "geolocator" package and in my case I needed it to get the geographic coordinates and call another function that returned the address data, looking like this:
On pubspec.yaml:
# location: ^3.0.0
geolocator: '6.2.1'
And I executed command:
flutter pub get
In AndroidManifest files, I added:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
For what I needed, which was to get the geographic coordinates, I did it as follows using "geolocator", replacing the previous code that used the "location" package:
import 'package:geolocator/geolocator.dart';
Future _obtemCoordenadas() async {
LocationPermission permissao;
Position _dadosLocalizacao;
await Geolocator.requestPermission();
permissao = await Geolocator.checkPermission();
if (permissao == LocationPermission.denied) {
permissao = await Geolocator.requestPermission();
if (permissao == LocationPermission.denied) {
return;
}
}
if (permissao == LocationPermission.deniedForever) {
return;
}
if (permissao == LocationPermission.always) {
_dadosLocalizacao = await Geolocator.getCurrentPosition();
var latitude = _dadosLocalizacao.latitude;
var longitude = _dadosLocalizacao.longitude;
localizacao.latitude = latitude.toString();
localizacao.longitude = longitude.toString();
}
}
Failed to resolve: com.google.android.gms:play-services in IntelliJ Idea with gradle
I just replaced version 11.2.0 with 11.0.0 and then it seemed to work fine, so that had to mean that 11.2.0 wasn't included with the latest Android SDK.
So, after struggling with all the available scattered documentation, I reached this document by pure chance (I guess it is not indexed high enough by Google):
https://developers.google.com/android/guides/releases
I quote from there:
Highlights from the Google Play services 11.2 release. Google Play
services dependencies are now available via maven.google.com
Now, even when that shouldn't necessarily mean that they are not available with the downloaded SDK anymore, it seems that this is actually the case.
Anyway, adding google() to my build.gradle didn't work (not found, undefined, or whatever...), so I used a different approach that I found in this document referenced from the previous one:
https://developer.android.com/studio/build/dependencies.html#google-maven
I modified my build.gradle file adding that line to allprojects/repositories, as in:
allprojects {
...
repositories {
...
maven { url "https://maven.google.com/"}
}
}
And then also in the android section in the same build.gradle file:
project(":android") {
...
dependencies {
...
compile 'com.google.android.gms:play-services-ads:11.2.0'
}
}
Those two lines were enough to make Gradle sync without problems. I didn't need to add any plugins apart from the ones that are already added in my libGDX project by default.
After that, I got a few different errors, but none about Gradle or dependencies. In a brief, JFTR:
First, I had a minSdkVersion of 8. Solved by raising it to 14. I think I could live without supporting all those devices below 14.
Second, I had problems with the dex upper limit of references. I've never faced this problem before, but maybe you've already noticed the solution I used: instead of compiling the whole 'com.google.android.gms:play-services' I used only 'com.google.android.gms:play-services-ads' that's the API I'm actually interested right now. For those other particular cases where a solution like this may not be useful, this document could provide some better insight: https://developer.android.com/studio/build/multidex.html
Third, even after that I got this "jumbo" thing problem described and answered here: https://stackoverflow.com/a/26248495/1160360
And that's it. As of now, everything builds and my game does finally shows those Admob banners.
I've spent hours with this, thought, which makes me wonder if all these building automation systems we are using lately are worth the extra load they add.
I mean, the first time I had to add Admob to an app five years ago or so, I just had to download a .jar file and put it on a directory on my project. It was pretty obvious and the whole process, from googling "how to setup Admob in my android project" to have my app showing an Admob banner took me just a few minutes. I'm gonna leave it here, since this is not the place for such kind of debate.
Nonetheless, I hope my own experience is useful for someone else further.
Related Topics
How to Measure Height, Width and Distance of Object Using Camera
Adding Items to Endless Scroll Recyclerview with Progressbar at Bottom
Open Soft Keyboard Programmatically
Gradle Error: Minimum Supported Gradle Version Is 3.3. Current Version Is 3.2
Android Share Images from Assets Folder
Mediarecorder and Videosource.Surface, Stop Failed: -1007 (A Serious Android Bug)
Adb - Android - Getting the Name of the Current Activity
Customize Android Intent.Action_Send
How to Add Shortcut to Home Screen in Android Programmatically
Android Persistence Room: "Cannot Figure Out How to Read This Field from a Cursor"
Fragments Onresume from Back Stack
How to Move the Layout Up When the Soft Keyboard Is Shown Android
Programmatically Obtain the Android API Level of a Device
Android Studio Gradle Dsl Method Not Found: 'Android()' -- Error(17,0)
How to Parse This Nested JSON Array in Android
Retrieving a List of Users Who Have Registered Using Firebase Auth