Google Places api AutocompletePrediction prediction.getDescription()MissingAfter升级到Play服务到9.4.0

hai*_*der 4 java android google-api google-places-api

由于firebase将play-services升级到9.4.0之后,因为它必须为firebase添加最新版本9.0.0或更高版本,因此我面临的问题是AutocompletePrediction预测.getDescription()现在显示为在我的项目中找不到,除了Gradle更新之外我还没改变任何东西,我认为新的播放服务缺少.getDescription方法,PLZ帮助我这是我的新Gradle`comped'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'
Run Code Online (Sandbox Code Playgroud)

} apply plugin:'com.google.gms.google-services'public and this one is my java file where >getDescription is missingPlaceAutocomplete getItem(int position){return mResultList.get(position); }

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;
}`
Run Code Online (Sandbox Code Playgroud)

Vin*_*ngh 7

如Google文档中所述,不推荐使用getDescription.

getDescription()现已弃用.请使用getFullText(),getPrimaryText()和/或getSecondaryText()来检索完整或部分描述,现在不推荐使用getMatchedSubstrings().请使用getFullText()更轻松地格式化匹配. https://developers.google.com/android/guides/releases