I have implemented GCM (Google Cloud Messaging) in my app. Google Play Services library has auto-generated values.xml
in which my senderId
is :
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="gcm_defaultSenderId">123</string>
</resources>
The problem is that I have other locale, and Lint during App Release is giving me an error :
Error:(3) Error: "gcm_defaultSenderId" is not translated in "fr" (French) [MissingTranslation]
Because it is automaticaly generated I can't set translable = false
. How I should fix this?
Add a lint.xml
file in your project application root (under app/) and add the missing translations to be ignored there:
<lint>
<issue id="MissingTranslation">
<ignore regexp="ga_trackingId"/>
<ignore regexp="gcm_defaultSenderId"/>
<ignore regexp="google_app_id"/>
</issue>
</lint>
These will now be ignored by lint - you can configure which properties to ignore, and you won't have to wait for updates from the google-services team for properties that they haven't thought of.
Lint-ing will still catch all other errors, so you can still enjoy the other features.
I assume that you are using Android Studio.
Had the exact same problem with Android Studio 1.4.
First thing I tried was to edit the "File - Settings - Editor - Inspections - Android Lint - Incomplete Translation" Severity Setting to something other then 'Error'.
That did not help! I still was not able to build a release APK.
I ended up 'translating' the XML as follows:
in the folder .../android/res create a new language folder values-de (replace de with your language code).
create a file named google-services.xml in the language folder.
Insert into the xml file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="gcm_defaultSenderId"><YOUR_SENDERID></string>
</resources>
After that I was able to build the release.
Since the last update of Android Studio (1.5) I had this issue too. I solved it by updating the Google Services dependencies to the latest version.
According to this link, indeed,
This issue should be fixed with 8.3.0 Google Play Services and 1.5.0-beta2 dependency.
Hope this helps! :)
EDIT Integration: actually, while the gcm_defaultSenderId
string is now generated correctly (with translatable="false"
attribute), google_app_id
and ga_trackingID
strings, for instance, are not.
For those still having issues, 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