androidgoogle-mapsplaceautocompletefragment

unresolved class PlaceAutocompleteFragment


This is my .xml file
I added the PlaceAutocompleteFragment but its shows unresolved class PlaceAutocompleteFragment. I cheched the dependency file all things are added.

<fragment
        android:id="@+id/autocomplete_fragment"
        android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

This is my gradle. I don't know where is my mistake please verify my code and tell where is the error.

implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.google.android.gms:play-services-maps:11.8.0'
    implementation 'com.google.android.gms:play-services-location:11.8.0'
    testImplementation 'junit:junit:4.12'
    testImplementation 'com.android.support.test:runner:1.0.1'
    testImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

Solution

  • You have to add this dependency, it is used for google places

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