启用最小化后,Google Places API自动完成错误

时间:2019-07-10 08:04:24

标签: android google-places-api googleplacesautocomplete

我正在使用新的google-places api,从片段调用autocompleteactivity意图,当我在gradle文件中将minifyEnabled设置为true时,自动完成功能无法加载任何结果。如果将属性设置为false,它将起作用。需要帮忙。谢谢。

try {
                        /*
                         * Initialize Places
                         */
                        if (!Places.isInitialized()) {
                            Log.d(TAG, "initialized places api");
                            Places.initialize(getActivity().getApplicationContext(),
                                    getResources().getString(R.string.places_api_key));
                        }

                        // Set the fields to specify which types of place data to return.
                        List<Place.Field> fields = Arrays.asList(Place.Field.ID,
                                Place.Field.NAME, Place.Field.ADDRESS, Place.Field.LAT_LNG);

                        // Start the autocomplete intent.
                        Intent intent = new Autocomplete.IntentBuilder(
                                AutocompleteActivityMode.FULLSCREEN, fields)
                                .build(getActivity());
                        startActivityForResult(intent, REQUEST_PICK_PLACE);
                    } catch (Exception e) {
                        Log.e(TAG, "exception", e);
                    }

当回退logcat时,我收到以下消息:“自动填充时出错:ERROR”

0 个答案:

没有答案