Fawfulcopter Fawfulcopter - 1 year ago 243
Android Question

Cannot import Google Places PlacePicker into Android project

I'm attempting to write a simple program that involves using a

to capture location information. My project, however, can't seem to resolve the necessary imports.


dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'com.google.android.gms:play-services-maps:9.2.0'


import com.google.android.gms.location.places.Place; // "Place" is not resolved
import com.google.android.gms.location.places.ui.PlacePicker; // "ui" is not resolved
import com.google.android.gms.maps.model.LatLng;

import seems to work, but not the other two. The whole project runs fine when I import the full
API, but I want to use specific API calls to cut back on unnecessary libraries.

Answer Source

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'

It's been answered here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download