PlaceAutocompleteFragment can't resolved

偶尔善良 提交于 2019-12-01 06:32:01

The problem here is that PlaceAutocompleteFragment didn't exist in version 8.3 of Google Play Services.

This isn't documented very well, but you can see on this blog that PlaceAutocompleteFragment was "announced" in December 2015.

You can also see in the PlaceCompleteFragment Google code samples on GitHub that they are using version 8.4 of GooglePlayServices.

I also had this problem, and updating Google Play Services is what made it work.

So, update Google Play Services in the SDK Manager, and then modify the build.gradle like so, and it should work:

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

Update

In newer versions of Google Play Services, they have broken out the Google Places API, so you need to include it in addition to Maps and Location:

compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
compile 'com.google.android.gms:play-services-places:11.0.2'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!