Which library should I use for Location when using google maps? - android

I have the following library for the google maps and it works fine
implementation 'com.google.android.gms:play-services-maps:16.1.0'
But when I try to add this one for location,
implementation 'com.google.android.gms:play-services-location:16.1.0'
the following error occurs
Failed to resolve: com.google.android.gms:play-services-location:16.1.0
Which library for the location should I use?
THANK YOU.

You will get latest gradle dependencies here
https://developers.google.com/android/guides/setup

It is probably because 16.1.0 does not exist for this library. Google Play Services libraries do not always have the same version. So maps might be on 16.1.0 but location might not even have this version.
To get the latest versions, check the official release page: https://developers.google.com/android/guides/releases
And as you are just starting, make sure to use the latest ones:
com.google.android.gms:play-services-location:17.0.0
com.google.android.gms:play-services-maps:17.0.0
Yes, it is a coincident that those versions are currently the same. As you can see in the list there are already libraries on 19.0.0, like appindexing
com.google.firebase:firebase-appindexing:19.0.0
Edit
A small practical tip: If you replace the version by + and sync the project, gradle will get the newest one and afterwards you can use the IDE warning to replace the + again with the newest version number. That eases a bit the checking on different pages if there is a new version or not etc

Related

Failed to resolve: com.google.android.libraries.places:1.0.0:

I want to use Google places API but I can't sync the project with "com.google.android.libraries.places:1.0.0:" dependency. How to add the places in my project?.
The library in documentation is wrong I guess, use this, it works.
I had same issue few days back , gave a feedback to them on documentation they still didn't fix it.
implementation 'com.google.android.libraries.places:places:2.1.0'
You can see how to add places autocomplete over here
Edit: Seems like they finally fixed the documentation
try to change
compileOnly "com.facebook.react:react-native:+"
by
api "com.facebook.react:react-native:+"
I also stuck with the same issue, now i removed this issue. According to google,
"The v1.0.0 release of the Places SDK for Android introduces an all-new static library with updated functionality. The Google Play Services version of the Places SDK for Android (in Google Play Services 16.0.0) is deprecated as of January 29, 2019, and will be turned off on July 29, 2019."
Add following dependency it will work...
implementation 'com.google.android.libraries.places:places:1.0.0'
For more information you can visit,
https://developers.google.com/places/android-sdk/client-migration

appcompat-v7:28.0.0-rc02 doesn't work with design:28.0.0-rc01(should be rc02, but we can't)

com.android.support:appcompat-v7:28.0.0-rc02
com.android.support:design:28.0.0-rc01 -> should be rc02, but there's no rc02 actually.
error:
app/build.gradle:74: Error: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
Found versions 28.0.0-rc02, 28.0.0-rc01. Examples include com.android.support:animated-vector-drawable:28.0.0-rc02 and com.android.support:cardview-v7:28.0.0-rc01 [GradleCompatible]
I know it's a warning, we have turned to warn as the errors in CI in order to avoid the potential dead crashes, well, any solution except turn off option for CI?
issue
UPDATE
Design library version 28.0.0-cr02 published.
OLD ANSWER
According to this link
https://mvnrepository.com/artifact/com.android.support/design?repo=google
design:28.0.0-rc02 not yet published.
So all you can do for now is use the previous version for appcompat and wait until design library new version28.0.0-cr02 release.
So for now use this :
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
I don't know why... But they(sdk devs) behaving like Microsoft..
"Ohh..It compiles, lets ship it".
They just launch and don't care about bugs.. after updating to latest libs every time, first thing i get is..
"Layout editor preview errors.".
i hope it will be easy next time. :/
Keep track of the library here, until its published, use rc01 for other ones.
https://mvnrepository.com/artifact/com.android.support/design?repo=google
That's why I use stable versions always
If you are developing an app, you don't want to face these type of errors.
At the time of answering the current most stable version is 27.1.1 and second 28.0.0-rc02.
I suggest use 27.1.1 until 28 stable version release.
implementation 'com.android.support:appcompat-v7:27.1.1'
Sync again
No need of Invalidate/ Restart, Just restart would be okay. Or closing project and reopening from recent would be faster then restart.
Track the support library release.
Replace your
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
with
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
Looks like this should no longer be an issue. Looking at the link below, i think that whatever hiccups were encountered by OP are no longer relevant.
https://mvnrepository.com/artifact/com.android.support/appcompat-v7/28.0.0-rc02
About the error message "All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes)." The solution is outlined here (the answer by João Paulo Paiva).
To rid yourself of the error message, you have to basically include each package name mentioned in the warning - com.android.support:animated-vector-drawable:28.0.0-rc02 and com.android.support:cardview-v7:28.0.0-rc01
Essentially, manually add the following lines to your build.gradle
implementation com.android.support:animated-vector-drawable:28.0.0-rc02
implementation com.android.support:cardview-v7:28.0.0-rc02
You may encounter more such warnings - the solution is to keep subsequently adding the libraries/dependencies mentioned (and updating the version to 28.0.0-rc02 as well) until the warnings go away. I had this issue, and after the first lot, I didn't get any more, but YMMV!
1.Go to project/.idea/libraries folder on your file system and see which libraries are different.
2.You will have to manually include these libraries with the same version in your build.gradle file.
3.Then, sync your project
In Your Case:-
Add This Dependency :-
implements 'com.android.support:cardview-v7:28.0.0-rc02'
Add all dependency with Latest version which shows in error message.
I close this ticket, the problem has been solved that Google has updated design library to 28.0.0-rc02 .

Android Firebase and google service latest version conflicts

I am use the latest version for individual dependencies.
Versions are referenced from here and here
But I am still getting warning message of conflict versions.
Not sure if it is safe to use like this.
Images attached below.
you can update same version all play services dependencies and solve the issues
Also try to remove your custom libraries from project and sync project. Old versrions of libraries can be used by them.

there is something wrong with my appcompat version

I don't really understand why my appcompat version is not accepted
Please help
click to see image
This is a warning, your app will still run.
One or more of your transitive dependencies is requesting different version of of the Android Support Library that you are not requesting directly yourself, resulting in this conflict. You will need to run a Gradle dependency report and find out what is causing the problem, then manually request those artifacts yourself with your desired version (presently, 27.0.1).
I think in your case facebook is using old version, you should try updating facebook dependency version to latest.
You can see this answer as well.
You have probabelly some libraries that use older versions of some others support libraries (not especially AppCompat), so you have to override them manually in the gradle to get rid of this warning.
You have to repeat this until the warning disapear :
When you see the hint, copy and past the library and update the version number : for example if in the hint you have
"blablabla... example include blablabla...
com.android.support:support-core-ui:26.0.1"
Add this to the dependencies section of the build.gradle script :
implementation 'com.android.support:support-core-ui:27.1.1'

Google play services maps 9.2.0 issue

My Android app has been successfully using maps by including the following in my gradle ...
compile project(':googleplayservices_lib')
My SDK manager says I have rev 32 which appears to be the latest. So with this, everything has been working just fine.
Now I'm enhancing the app and I saw some posts that says I can now use zIndex parameter when adding a marker to control the Z Index. But to do this I must add the following to my gradle . . .
compile 'com.google.android.gms:play-services-maps:9.2.0'
So now my gradle file has this dependencies section . . .
dependencies {
compile project(':library')
compile project(':googleplayservices_lib')
compile files('libs/gson-2.2.4.jar')
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-maps:9.2.0'
}
Now I'm able to set zIndex but this new version apparently comes with breaking changes. For instance the following no longer works . . .
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
map is a GoogleMap. The compiler cannot resolve the getMap() method. My problem is that I can't seem to locate the documentation on this new maps revision where it discusses breaking changes for this new version. Does anyone know where I can find such information?
My Android app has been successfully using maps by including the following in my gradle
Presumably, that is an in-project copy of the old Eclipse library project edition of the Play Services SDK. Ideally, you would have moved off of that to the Play Services SDK artifacts back when you moved to Android Studio.
My SDK manager says I have rev 32 which appears to be the latest
Since you are using a local in-project copy, what the SDK Manager reports is not directly relevant.
Also, Google has not been maintaining that library project for at least the past several months, so "latest" of that library is meaningless with respect to using the latest version of the Play Services SDK.
So now my gradle file has this dependencies section . . .
I am surprised that compiles. Remove compile project(':googleplayservices_lib'). If you are using parts of the Play Services SDK beyond Maps V2, use appropriate and compatible artifacts for those APIs as well.
The compiler cannot resolve the getMap() method.
getMap() was deprecated about 20 months ago, in favor of getMapAsync().
My problem is that I can't seem to locate the documentation on this new maps revision where it discusses breaking changes for this new version.
Maps V2 release notes are in the Play Services documentation. A subset of Maps V2 release notes are incorporated in the overall Play Services release notes.

Categories

Resources