Google map not loading on normal devices but loads on test device(real device)

落爺英雄遲暮 提交于 2019-11-30 20:35:00

问题


I have a google map in my android application, i have got the api key in my app from Google api console and it sucessfully loads the map in my test device and to those device with whom i shared the apk file, but after i have published the app on play store, and the user downloads the app, the map does not load. This is how the app looks while functioning normally on a test device.

This is how it looks after downloading the app

Api console

Am i missing any steps ?


回答1:


The problem is that you have not added the SHA1 key of your signed apk in your google api console.

Do this-

While creating your signed apk for production copy the new SHA1 key of the signed build.

During the process of signing, output similar to that outlined below will appear within the Console panel:

[2013-06-13 10:34:39 - ReleaseTest] New keystore C:\Users\nas\Documents\AndroidReleaseAPK\ReleaseTest.apk has been created.
[2013-06-13 10:34:39 - ReleaseTest] Certificate fingerprints:
[2013-06-13 10:34:39 - ReleaseTest]   MD5 : FA:65:D--------------
[2013-06-13 10:34:39 - ReleaseTest]   SHA1: D1:E-------------------

or it will also appear on the popup where you will name your build finally before signing it.

Use this SHA1 to create new key at api console and include that in your app. The map will load successfully.

Edit:-After you have followed the above procedure, do not right click and run the project again from eclipse, that will make the app to load from its default sha1 key. After you sign the app, manually copy paste the signed .apk to your device. That will make it work.




回答2:


If you have tried other suggestions, note that there are 2 google_maps_api.xml files in your project, under src/debug and under src/release/. Make sure that the latter has a Google Maps API key for your signed APK release to function correctly.

Project file screenshot:




回答3:


Someone new drop here can use the followig:

keytool -list -printcert -jarfile app.apk

Add the new SHA1 to api console and map should start showing map and markers.



来源:https://stackoverflow.com/questions/28810212/google-map-not-loading-on-normal-devices-but-loads-on-test-devicereal-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!