Ahmed Cheema
Ahmed Cheema

Reputation: 15

Android studio can not resolve import com.google.android.gms.location.places.Place;

I am trying to implement a autocomplete places search using Street View API. I following are my dependencies:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.google.android.gms:play-services-maps:11.0.4'
    testCompile 'junit:junit:4.12'
}

The meta-data is as follows:

    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

I have all the required SDK installed, but my android studio can not resolve the places part in the following imports:

import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlaceAutocomplete;

This is how it looks like: Error

Upvotes: 2

Views: 1058

Answers (2)

Tara
Tara

Reputation: 700

Add this in build.gradle (Module app) at bottom.

apply plugin: 'com.google.gms.google-services'

Upvotes: 0

Amy
Amy

Reputation: 4032

Add this dependency in gradle file

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

Upvotes: 1

Related Questions