I'm attempting to write a simple program that involves using a PlacePicker
to capture location information. My project, however, can't seem to resolve the necessary imports.
build.gradle
:
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'
}
Activity:
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;
The LatLng
import seems to work, but not the other two. The whole project runs fine when I import the full com.google.android.gms:play-services:9.2.0
API, but I want to use specific API calls to cut back on unnecessary libraries.
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
.
implementation 'com.google.android.gms:play-services-places:9.2.0'
It's been answered here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With