I had a working Google Maps in my application and I had to start to work with an other computer.
So I downloaded my sources on this new computer with Android Studio and so one.
And now, I am not able to make the Android Map displays anymore.
I added the SHA1 from my new computer in Google Console but it still doesn t work...
I have this kind of message in my logcat :
Error processing: com.google.maps.api.android.lib6.b.d@536cbcf8 not retrying
Error processing: com.google.maps.api.android.lib6.gmm6.d.h@539c5f14 not retrying
I think my Manifest is OK because this config used to work but here it is :
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.GET_TASKS"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
...
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<uses-library android:name="com.google.android.maps" />
Does anyone have an idea?
EDIT : ANSWER
OK so I didnt think it was, but it really was a problem with the SHA 1 key. When I changed computer, I only added my signed APK key and forgot to add my debug APK key and I was compiling in debug release.
Thank to all of you :)
since 2 different machines have two different debug keys, you should copy your old debug.key file from previous machine android sdk to new machine android sdk folder or else you should go to new map api key with new machine debug.key file
Make sure you have enabled Google Maps Android API v2
in the APIs list on your project's Google page.
This generated the same error you got. I wasted a couple of hours with this so hopefully it will save someone's time in the future.
go to your GoogleMapsAPI credential and input your package along with your android keyhash.
Check Google maps API key generation is done correctly.
This will help you
http://www.w3schools.com/googleapi/google_maps_api_key.asp
AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
Add Inside application tag
<!--For Android Pie to Load Map-->
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="GOOGLE_API_KEY" />
XML
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="200dp" />
Load Map in Fragment
implements OnMapReadyCallback
private GoogleMap mMap;
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
FragmentManager fm = getChildFragmentManager();//getActivity().getSupportFragmentManager();/// getChildFragmentManager();
SupportMapFragment mapFragment = (SupportMapFragment) fm.findFragmentById(R.id.map);
if (mapFragment == null) {
mapFragment = SupportMapFragment.newInstance();
fm.beginTransaction().replace(R.id.container, mapFragment).commit();
}
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.getUiSettings().setScrollGesturesEnabled(false);
mMap.getUiSettings().setZoomGesturesEnabled(false);
mMap.getUiSettings().setZoomControlsEnabled(false);
mMap.getUiSettings().setMapToolbarEnabled(false);
LatLng latLng = new LatLng(LATITUDE,LONGITUDE);
mMap.addMarker(new MarkerOptions().position(latLng));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15));
}
Load Map in Activity
implements OnMapReadyCallback
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.getUiSettings().setScrollGesturesEnabled(false);
mMap.getUiSettings().setZoomGesturesEnabled(false);
mMap.getUiSettings().setZoomControlsEnabled(false);
mMap.getUiSettings().setMapToolbarEnabled(false);
LatLng latLng = new LatLng(LATITUDE,LONGITUDE);
mMap.addMarker(new MarkerOptions().position(latLng));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15));
}