android - Google Play Services - Client Version vs Package Version -
i have migrated existing android app android studio / gradle. having problems map, working.
i have cloned android-maps-utils library google , added project. have added dependency android-map-utils gradle.build file.
when load screen contains map, following sequence logcat:
i/google maps android api﹕ google play services client version: 5089000
i/google maps android api﹕ google play services package version: 5089036
i/google maps android api﹕ failed contact google servers. attempt made when connectivity established.
e/google maps android api﹕ failed load map. error contacting google servers. authentication issue (but due network errors).
i going go new maps api key, curious if thinks google play services client version / package version difference causing problem, , how fix it?
the package version shown newer client version, in case not version compatibility issue.
given have api key, causes in case either:
- you haven't registered sha-1 fingerprint of signed app in list of authorised apps accessing api key in google apis console (you need debug-signed app)
or
- you haven't signed app.
or
- permissions missing in manifest:
<uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.write_external_storage"/> <!-- following 2 permissions not required use google maps android api v2, recommended. required if access user's current location, either programmatically, or enabling location layer.--> <uses-permission android:name="android.permission.access_coarse_location"/> <uses-permission android:name="android.permission.access_fine_location"/>
see app signing / registration description in getting started section maps api: https://developers.google.com/maps/documentation/android/start#get_an_android_certificate_and_the_google_maps_api_key
also, try adding following code before loading map more details on access failure:
string googleerror = null; switch (mapsinitializer.initialize(ctx)) { // or googleplayservicesutil.isgoogleplayservicesavailable(ctx) case connectionresult.service_missing: googleerror = "failed connect google mapping service: service missing"; break; case connectionresult.service_version_update_required: googleerror = "failed connect google mapping service: google play services out of date. service version update required"; break; case connectionresult.service_disabled: googleerror = "failed connect google mapping service: service disabled. possibly app missing api key or not signed app permitted use api key."; break; case connectionresult.service_invalid: googleerror = "failed connect google mapping service: service invalid. possibly app missing api key or not signed app permitted use api key."; break; case connectionresult.date_invalid: googleerror = "failed connect google mapping service: date invalid"; break; } if (googleerror != null) log.d("myapp", googleerror);
Comments
Post a Comment