3

I wanted to implement PlaceAutocompleteFragment based on the docs, in my app but when I add this snippet

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

the last line throws "cannot resolve symbol 'PlaceAutocompleteFragment'." Why is that?

The_Martian
  • 3,684
  • 5
  • 33
  • 61

3 Answers3

1

The class was not found by the compiler. You have to import the class by adding following code snippet in your build.gradle file.

dependencies {
    compile 'com.google.android.gms:play-services-places:11.0.4'
}
Pankaj Lilan
  • 4,245
  • 1
  • 29
  • 48
0

cannot resolve symbol PlaceAutocompleteFragment.

The compiler cannot find the class. This means that the class has not been imported properly, the name is misspelt or the class simply does not exist.

Just add this

compile 'com.google.android.gms:play-services-location:8.4.0'

Finally

dependencies {
compile 'com.google.android.gms:play-services-location:8.4.0'
              }

You can visit How to Implement PlaceAutocompleteFragment and PlaceAutocompleteActivity to get Place details

Community
  • 1
  • 1
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
-1

Just add this

implementation 'com.google.android.gms:play-services-places:11.6.0'
Hamdan Hejazi
  • 139
  • 1
  • 1
  • 11