【发布时间】:2016-08-02 07:03:00
【问题描述】:
由于 firebase,我将 play-services 升级到 9.4.0 后,因为它必须为 firebase 添加最新版本 9.0.0 或更高版本,所以我遇到了问题,因为 AutocompletePrediction prediction.getDescription() 现在显示为找不到我的项目,除了 Gradle 更新,我没有改变任何东西,我认为新的播放服务缺少 .getDescription 方法,请帮助我 这是我的新 Gradle ` compile 'com.google.firebase:firebase-core:9.4.0'
compile 'org.osmdroid:osmdroid-android:5.1@aar'
compile 'com.github.MKergall.osmbonuspack:OSMBonusPack:v5.7'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-identity:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
}
应用插件:'com.google.gms.google-services'
and this one is my java file where >getDescription is missingpublic PlaceAutocomplete getItem(int position) {
返回 mResultList.get(位置);
}
private ArrayList<PlaceAutocomplete> getPredictions(CharSequence constraint) {
if (mGoogleApiClient != null) {
Log.i(TAG, "Executing autocomplete query for: " + constraint);
PendingResult<AutocompletePredictionBuffer> results =
Places.GeoDataApi
.getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
mBounds, mPlaceFilter);
// Wait for predictions, set the timeout.
AutocompletePredictionBuffer autocompletePredictions = results
.await(60, TimeUnit.SECONDS);
final Status status = autocompletePredictions.getStatus();
if (!status.isSuccess()) {
Toast.makeText(getContext(), "Error: " + status.toString(),
Toast.LENGTH_SHORT).show();
Log.e(TAG, "Error getting place predictions: " + status
.toString());
autocompletePredictions.release();
return null;
}
Log.i(TAG, "Query completed. Received " + autocompletePredictions.getCount()
+ " predictions.");
Iterator<AutocompletePrediction> iterator = autocompletePredictions.iterator();
ArrayList resultList = new ArrayList<>(autocompletePredictions.getCount());
while (iterator.hasNext()) {
AutocompletePrediction prediction = iterator.next();
resultList.add(new PlaceAutocomplete(prediction.getPlaceId(),
prediction.getDescription()));
}
// Buffer release
autocompletePredictions.release();
return resultList;
}
Log.e(TAG, "Google API client is not connected.");
return null;
}`
【问题讨论】:
标签: java android google-api google-places-api