12

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.

Community
  • 1
  • 1
Marian Paździoch
  • 8,813
  • 10
  • 58
  • 103

2 Answers2

2

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
    }
}
...
Community
  • 1
  • 1
CristinaTheDev
  • 1,952
  • 2
  • 17
  • 25
  • It kinda is a duplicate. But please see my question "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." The original question owner accepted most ridiculous answer possible so I had to create another question to gather other, hopefully correct, answers. Please update your question to actually state what need to be done and I'll check if it helps. – Marian Paździoch Nov 30 '15 at 08:19
  • Anyway it did not help. – Marian Paździoch Nov 30 '15 at 09:23
  • I'm sorry I didn't explain well, I agree with you in the fact that the accepted answer is not the best practice to solve the problem, even not recommended in my opinion because it's just a workaround that bypasses the real problem. Actually, the day after my answer I had some other problems related to the first, other generated strings giving me problems (though the "gcm_defaultSenderId" is not among these because after the update it's generated with the "translatable" property set to false). I'm currently investigating what I can do to solve these other problems, I'll update when I find out. – CristinaTheDev Dec 01 '15 at 14:38
  • After more researches I found this [link](https://github.com/grazies/analytics-issues/issues/733). Here is confirmed that the issue is fixed for `gcm_defaultSenderId` but still present for the other strings (as I experienced in first person) I came to the conclusion that we have to ignore the lint error and then try again with each new version of the com.google.gms:google-services that comes out if this is totally fixed. – CristinaTheDev Dec 02 '15 at 17:12
  • Anyway I'm sorry I received a downvote, I answered on the first instance because I actually thought the issue was fixed. That happened because I'm working at a multiflavor app and, for some reasons I'm still investigating, the gradle plugin only generates `gcm_defaultSenderId` string on flavors other than the main one so I didn't notice the issue was still there until I needed to build the main flavor the next day. I'm editing my response now to make it correct. – CristinaTheDev Dec 02 '15 at 17:16
  • Please check issue reported by me to google https://code.google.com/p/android/issues/detail?id=195824 and update it if you know of any other strings that need special treatment. – Marian Paździoch Dec 03 '15 at 10:06
0

Try this

android {
 lintOptions {
    disable 'MissingTranslation'
}

}

abi
  • 1,002
  • 12
  • 15