Google-map work on emulator but doesn't on real device

久未见 提交于 2019-12-04 06:54:30

问题


I applied the exact steps as mentioned in the google developer doc to create an example google map project and everything went fine on the emulator, but when I generated the project apk file and launched it on real device Samsung Galaxy S4 google map doesn't show up it shows only a blank background with just colored Google logo appearing on the left lower screen corner !!

What could be the problem? Plz Help.


回答1:


It is working on emulator on debug mode because you are using the Google Map Api key which is register with your debug.keystore file. To access Google Map into the real device you have to generate the Google Map key using the keystore file which you are using to generate the apk file.




回答2:


Did you installed Google Setting App on your mobile.

Check this




回答3:


You will get .keystore or .jks file while generating signed APK.In fact using that you have to create the finger print for your application which is later used to generate Android Key in Google developer console.

Now what you have to do is use the command to generate the SHA-1 certificate fingerprint

 keytool -list -v -keystore "path_to_jks_file.jks" -alias androiddebugkey -storepass android -keypass android

In that path_to_jks_file.jks you should give the path of your .jks file that you got when generating signed APK.

And get your android key from google developer console then add it in manifest

And remember to add the signing configuration to your build.gradle

signingConfigs {
        release {
            storeFile file("myreleasekey.jks")
            storePassword "password"
            keyAlias "MyReleaseKey"
            keyPassword "password"
        }
    }

Signing your application

Visit for clarification.

An elaborated explanations Signup and API Keys

AFAIK these information's good enough for resolving your issue.tell me if any further.




回答4:


It's important to remember that Build Releases debug and release mode often have different (.xml) values file. if you are using a Linked Resource File (eg: Google_maps_api.xml) to manage your Maps Api Key, you need to update both files with their appropriate keys.

Keys must be signed using the same procedure as described above ( using your .jks keystore file ..etc )



来源:https://stackoverflow.com/questions/33688839/google-map-work-on-emulator-but-doesnt-on-real-device

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