"Google Play services are updating" in Google Maps API
Asked Answered
A

5

11

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.

enter image description here

Arithmetic answered 6/3, 2017 at 10:30 Comment(6)
Is the api key for Google Maps Android API enabled?Misdemeanant
Of course @ShakSmithArithmetic
@GuidoLodetti Are you using proguard?Estell
@Fondesa yes. I don't know if minimizing is related to Proguard, but if I set in Gradle "minimize" to true, and "debuggable" to true, everything works great. If I set debuggable to false it stops working.Arithmetic
An issue with the same error message occurred in the latest Google Play Services update, version 12.6.73, on Huawei devices. Linking since this is the top Google result at the moment.Kalif
Possible duplicate of "Google Play services are updating" error on release, not emulator (Google Play Services 12.6.73, Huawei devices)Patois
M
4

"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

Manche answered 13/3, 2017 at 3:53 Comment(3)
The SHA-1 is correct. If I set debuggable to true, and sign it with production certificates, everything works correctly. If I switch to false, everything breaks.Arithmetic
You use production certificated for debug mode? then you use what for actual production builds?Manche
Before posting this question, I tried to analyze what could cause the problem since when debugging everything works, and when I publish to Google Play it doesn't work anymore. Turns out that the only factor that causes the bug is "debuggable" to "false". If I try to use the production certificate alone, no problem occurs.Arithmetic
S
1

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.

Schreiber answered 31/3, 2017 at 19:28 Comment(1)
Do NOT do this as this will keep every single class from the google packages. Your apk will be huged since those classes won't be optimized. You need to include the set of proguard rules that google has specified for their libraries.Disenfranchise
K
1

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

Kendrakendrah answered 17/5, 2018 at 9:47 Comment(0)
F
0

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.

Formate answered 16/3, 2017 at 5:7 Comment(0)
H
0

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.

Howlend answered 23/3, 2017 at 11:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.