“Google Play services are updating” in Google Maps API

时光怂恿深爱的人放手 提交于 2019-12-14 00:50:23

问题


I have an Android app which makes use of Google Maps. All of a sudden, it stopped working in release mode. The Map view tells Google Play services are updating on the emulator and on real devices. Searching on the net everyone talks about the API key file, but this is not my problem!

I have tried every possible different combination of release settings, and I have found out that the problem occurs when I set debuggable = false in the build configuration (with debuggable = true it works). I can't understand why Maps aren't working because, of course, the APK is not debuggable. I have also tried multiple versions of Google Play services, even the latest (10.2.0). No difference.

What can I do? Please help as I can't release any new release on Play Store until I fix this bug.


回答1:


"If I set debuggable to false it stops working"

This suggests your API access is restricted to debug mode. Considering there are not separate API keys for debug and release it would appear your key has been tied to your debug certificate.

To quote "More about API key restrictions" on the documentation:

You can optionally add a restriction. For Android apps, you restrict the key to your app's SHA-1 fingerprint

If you have such a restriction in place, the differing fingerprint of the release certificate will break your API access.

Take a look at the "Getting the certificate information yourself" section of the documentation linked above to get the correct (release) certificate fingerprint




回答2:


I had the same problem, and I managed to fix it. The problem occurs when the minifyEnabled option is set to true (when false the problem does not occur).

In short, what I did was to add the line:

-keep class com.google.** {*; }

into the proguard rules file (proguard-rules.pro), to avoid google play services dependencies from being obfuscated. At least in my case, the resulting APK doesn't seem to be much bigger if this rule is added.

I think the problem occurs when the use of map components is done from another module (for example in a shared library), but I didn't check it.




回答3:


Unfortunately, the latest Google Play Services is flawed, and embedded maps stop working on almost ALL Huawei/Meizu phone WORLDWIDE. No way to fix it clearing the cache, because at the next reboot the 12.6.73 Google Play Services is automatic updated again, and within few hours will stop working again. The only way is await of a google hotfix, that is supposed top be released pretty fast.

This is the google official defect tracking ticket about this issue:

https://issuetracker.google.com/issues/79405933




回答4:


Had same issue. Try to update your google play service from gradle and then check it. May be it will help you. One more thing, please use latest gradle version and target please set to more than or 17 also.




回答5:


Had the same "error", could be resolved by using these steps:

https://productforums.google.com/forum/#!topic/play/ey7qIRBYj-o

I know how you feel when you constantly receive a message saying ‘Google Play Services has stopped’. To fix this issue, I'd recommend clear cache for Google Play Services (Go to Settings > Apps or Application Manager > Google Play Services > Clear cache > OK) and and Google Play Store. Once you've cleared cache, restart your device to check if it's working.



来源:https://stackoverflow.com/questions/42623245/google-play-services-are-updating-in-google-maps-api

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