I've followed the tutorial https://developers.google.com/cloud-messaging/android/client. It works - I'm able to send and receive notifications.
But when I try to build release app, Android Lint complains:
Error: "gcm_defaultSenderId" is not translated in ...
So I can disable build failing when Lint complains with this in build.gradle
:
lintOptions{
abortOnError false
}
But obviously this is not a solution. Hardcoding senderId
in my app is also not good idea (we have valid gcm_defaultSenderId
anyway in the google-services.json
so doubling it is asking for problems in the future).
Is there any way around this obvious oversight from Google Play Services developers?
EDIT 02 December 2015 OMG! Today google actuallt started doing something on this issue, see here.
Disclaimer: this is not a duplicate of Can't generate APK Release because of GCM SenderId Android - the accepted answer is not acceptable for me.
I think this question actually is duplicate of Can't generate APK Release because of GCM SenderId Android even if I agree with your opinion about the accepted answer.
The solution is much simpler, you just need to update Google Services dependency version, take a look at the answer I gave there for details.
EDIT The solution I gave is not sufficient to solve the issue. I thought it was OK because I'm working on a multiflavor app and, for reasons I'm still investigating, the Google Services gradle plugin generates only the gcm_defaultSenderId
string in flavors other than the main one.
According to this link,
This issue should be fixed with 8.3.0 Google Play Services and 1.5.0-beta2 dependency.
But actually, while the gcm_defaultSenderId
string is now generated correctly (with translatable="false"
attribute), google_app_id
and ga_trackingID
strings are not.
TL;DR I came to the conclusion that we have to wait for Google guys to fix this issue and ignore the error in the meantime by adding to the app level build.gradle
file
...
android {
lintOptions {
abortOnError false
}
}
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With