kodw kodw - 2 months ago 6
Android Question

Can't generate APK Release because of GCM SenderId Android

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?

Answer

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:

  1. in the folder .../android/res create a new language folder values-de (replace de with your language code).

  2. create a file named google-services.xml in the language folder.

  3. 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.