Can't Import gms Location Place - android

After I Updated gms:play-services-location from 9.0.2 to 9.6.1, I couldn't import com.google.android.gms.location.places.Place and I couldn't use PlaceAutoComplete either.
Was it deprecated or removed from google play service location?

Per the list of split dependencies, to include the places APIs, you must include the dependency
compile 'com.google.android.gms:play-services-places:9.6.1'
The places dependency was only added in Google Play services 9.2.0 - before that, it was part of the maps dependency, which was a requirement for location (version 9.6.0 also removed the dependency of location on maps), hence why previously when you included location you also got places.

add this version in your gradle
compile 'com.google.android.gms:play-services:7.3.0'

Related

Android Implementing Google Places Error

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'
//.....
}

Fused Location Provider class not found despite Google Play Services dependency in gradle file

My app uses the FusedLocationProviderApi for getting the current location. I've already put the line which allows the app to use Google Play Services in the gradle file for my app module:
compile 'com.google.android.gms:play-services-ads:11.0.2'
But when I try to declare a FusedLocationProvider variable, it turns red and does not recognize the class. My only guess is that I should probably import the class, but I don't know exactly how.
You are currently only importing the ads API.
In addition to the ads compile line, you will need to add this to your build.gradle:
implementation 'com.google.android.gms:play-services-location:16.0.0'
To see the current breakdown of individual APIs, take a look at the documentation: https://developers.google.com/android/guides/setup

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.

Places class is removed from android play services 9.2.0

Today, I updated to google play services to 9.2.0.
I got an error
com.google.android.gms.location.places.Places
not found. that broke below two lines
.addApi(Places.GEO_DATA_API)
.addApi(Places.PLACE_DETECTION_API)
any leads on where i can find GEO_DATA_API, PLACE_DETECTION_API
Thanks in advance.
In 9.0.2, the 'places' library was inside 'location' library. In 9.2, you need to add 'places' library as dependency:
implementation 'com.google.android.gms:play-services-places:9.2.0'
The document is not updated as of 28th June. I suggest downgrading play services library to 9.0.2. (docs last updated on 23th June).
Edited:
as Emerson suggested,
compile 'com.google.android.gms:play-services-places:9.2.0'
add that for places library to your Gradle. It's not updated in official documentation.
for play service 9.2.0 places import has changed from
import com.google.android.gms.location.places;
to
import com.google.android.gms.location.places.Place;
or you need all places folder
import com.google.android.gms.location.places.*;

PlaceAutocompleteFragment can't resolved

In my app I have added Google Maps and they work fine. I want to add a PlaceAutocompleteFragment. I am using the key which I had already generate for maps and I have enable the option Places Api from google.console. I have added these to my build.gradle:
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services:8.3.0'
but when I try to use PlacesAutoCompleteFragment then Android Studio can't resolve this.
The problem here is that PlaceAutocompleteFragment didn't exist in version 8.3 of Google Play Services.
This isn't documented very well, but you can see on this blog that PlaceAutocompleteFragment was "announced" in December 2015.
You can also see in the PlaceCompleteFragment Google code samples on GitHub that they are using version 8.4 of GooglePlayServices.
I also had this problem, and updating Google Play Services is what made it work.
So, update Google Play Services in the SDK Manager, and then modify the build.gradle like so, and it should work:
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
Update
In newer versions of Google Play Services, they have broken out the Google Places API, so you need to include it in addition to Maps and Location:
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
compile 'com.google.android.gms:play-services-places:11.0.2'

Categories

Resources