我尝试使用youtube教程中的示例实施位置自动建议,但出现错误

时间:2019-03-14 15:40:49

标签: java android google-maps google-places-api

here is the link for the tutorial

this is the link for the sample code ,  这是我的代码:     mGoogleApiClient= new GoogleApiClient .Builder(this) .addApi(Places.GEO_DATA_API) .addApi(Places.PLACE_DETECTION_API) .enableAutoManage(this,this) .build(); mPlaceAdapter=new PlaceAutocompleteAdapter(this,mGoogleApiClient,LAT_LNG_BOUNDS,null);

PlaceAutocompleteAdapter类的构造方法:

public PlaceAutocompleteAdapter(Context context, GeoDataClient geoDataClient,
                                LatLngBounds bounds, AutocompleteFilter filter) {
    super(context, android.R.layout.simple_expandable_list_item_2, android.R.id.text1);
    mGeoDataClient = geoDataClient;
    mBounds = bounds;
    mPlaceFilter = filter;
}

我的gradle中已包含所有必要的进口物品:

implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation  'com.google.android.gms:play-services-location:15.0.1'

和我得到的错误:

error: incompatible types: GoogleApiClient cannot be converted to GeoDataClient

0 个答案:

没有答案