I am trying to implement Google Places on my Android App. I already have Google Maps working and I have enabled the Places SDK for Android API to the project but it still does not recognize any of the Places's classes.
import com.google.android.gms.location.places.AutocompleteFilter;
import com.google.android.gms.location.places.AutocompletePrediction;
import com.google.android.gms.location.places.AutocompletePredictionBufferResponse;
import com.google.android.gms.location.places.GeoDataClient;
The project does not recognize these imports.
The Place Picker is deprecated as of January 29, 2019. This feature will be turned off on July 29, 2019, and will no longer be available after that date. To continue using the Place Picker through the deprecation period, do NOT disable the Places SDK for Android in your Google Cloud Platform project, as doing so will also disable the Place Picker.
https://developers.google.com/places/android-sdk/client-migration#compat
Maps != Places != Routes
You probably don't have the dependency yet on the build file. However, due to Google's recent Maps monetization policy, you will have to setup a billing account. Go here: https://cloud.google.com/maps-platform and complete the mini wizard. It will do additional setup on your projects and will probably (I didn't go through it yet) give you the exact implementation sentence you need to declare.
The GeoDataClient and AutocompletePredictionBufferResponse classes were added in Google Play Services 11.2.0.
So, make sure that you're using at least version 11.2.0 of Google Play Services:
dependencies {
compile 'com.google.android.gms:play-services-maps:11.2.0'
compile 'com.google.android.gms:play-services-location:11.2.0'
compile 'com.google.android.gms:play-services-places:11.2.0'
//.....
}
Related
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
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
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.
I am implementing Google plus login system to my android app by following the tutorial of google developer at https://developers.google.com/identity/sign-in/android/sign-in
According to the tutorial, I should implement:
GoogleApiClient.ServerAuthCodeCallbacks
interface to enable server-side API access for the android app. However, 'ServerAuthCodeCallbacks' interface does not exist in the GoogleApiClient library, even in the latest version of the library.
Does anybody have the same issue? Or, am I missing something?
Any input will be greatly appreciated!
See the example implementation on GitHub: github.com/googleplus/gplus-quickstart-android
Your dependency on com.google.android.gms:play-services must be at least of version 7.0.0 (currently latest is version 7.5.0)
Class itself is currently placed in package com.google.android.gms.common.api in Maven sub-dependency play-services-base
So for example like this:
dependencies {
compile 'com.google.android.gms:play-services:7.5.0'
}
Also see current Developer documentation here:
https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project
I'm trying to integrate google maps API v2 into my project.
My build dependency is:
dependencies {
compile 'com.android.support:support-v4:13.0.0'
compile 'com.google.android.gms:play-services:4.0.30'
}
I've downloaded the android google play services and the google repository.
However, when i actually try to import the maps module the only directory that's displayed is:
import com.google.android.gms.R;
What's the reason for this? How can i import import com.google.android.gms.maps?
First make sure the versions for support and google play services you are using are available in your Android SDK under directory
For Support
$SDK_DIR\extras\android\m2repository\com\android\support\support-v4
For Google Play Services
$SDK_DIR\extras\google\m2repository\com\google\android\gms\play-services
In case you are using Android Studio 0.4.2 do upgrade it to 0.4.3 because there were some dependency related issues in 0.4.2.