Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio can not resolve com.google.android.gms.location.places.AutocompleteFilter

Tags:

I am trying to implement a autocomplete places search following this article.

http://www.truiton.com/2015/04/android-places-api-autocomplete-getplacebyid/

I have followed all steps, and also added proper dependencies in my build.gradle file.

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.google.android.gms:play-services:6.5.87' } 

Also here are the meta data section in my manifest.

    <meta-data         android:name="com.google.android.gms.version"         android:value="@integer/google_play_services_version" />     <meta-data         android:name="com.google.android.maps.v2.API_KEY"         android:value="@string/google_maps_key" /> 

also I have all the required SDK components installed. Still my android studio can not resolve the places part in the following imports:

import com.google.android.gms.location.places.AutocompleteFilter; import com.google.android.gms.location.places.AutocompletePrediction; import com.google.android.gms.location.places.AutocompletePredictionBuffer; import com.google.android.gms.location.places.Places; 

this is how they look as they can not find the Places part.

enter image description here

How can I resolve this issue? I am using SDK 19 for my app.

like image 857
Bluemarble Avatar asked Jun 21 '15 18:06

Bluemarble


2 Answers

Add compile 'com.google.android.gms:play-services-places:<version>, where <version> is perhaps at least: 9.2.1 under dependencies in your modules's build.gradle

like image 197
Ujjwal Singh Avatar answered Sep 20 '22 15:09

Ujjwal Singh


In play-services 9.2.0 the places API is no longer located in location. Those are now in their own places dependency. To resolve those you should add this to your build.gradle.

compile 'com.google.android.gms:play-services-places:9.2.0' 

check out

Places class is removed from android play services 9.2.0

like image 20
vishwajit76 Avatar answered Sep 23 '22 15:09

vishwajit76