I wanted to implement AutocompleteFragment (google places) but when I click to search view in a fragment, the fragment disappears (fell down). Google Maps and Places API work and in console I see error:
places.PlacesService.AutocompleteWidget: 100
I can't find what it could mean. I tried to use advices in this and this answers, but it didn't work.
My build.gradle implementations:
implementation 'com.google.android.gms:play-services:+'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:+'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.android.gms:play-services-places:16.0.0'
Permissions and meta-data in Android.manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="it.mappe.permission.MAPS_RECEIVE" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="there_is_my_api_key"/>
In activity layout I have this XML:
SupportMapFragment mapFragment;
SupportPlaceAutocompleteFragment autocompleteFragment;
GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
}
@Override
protected void onStart() {
super.onStart();
createMapView();
}
private void createMapView() {
getSupportFragmentManager().executePendingTransactions();
mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapView);
mapFragment.getMapAsync(this);
autocompleteFragment = (SupportPlaceAutocompleteFragment) getSupportFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
.setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES)
.build();
autocompleteFragment.setFilter(typeFilter);
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(com.google.android.gms.location.places.Place place) {
Log.i(TAG, "Place: " + place.getName());
}
@Override
public void onError(Status status) {
Log.e(TAG, "An error occurred: " + status + ", status code " + status.getStatusCode());
}
});
}
And when I tap searchview in fragment I see this in LogCat:
An error occurred: Status{statusCode=ERROR, resolution=null}, status code 13
And this page give me a beutiful explaination of "status code 13":
The operation failed with no more detailed information.
Thanks for any advice
I got the same error "error 13" ,and I asked that question in stackoverflow .
Although I did not get any answer but I got a comment from the person who works at Google maps. He said its a bug from googles side
Here is the link to my question
I looked for answers try them :
api key library should consist places api for android,web and maps multidex support should be there