37

I'm trying to publish my Android app by following the instructions here:

http://ionicframework.com/docs/guide/publishing.html

However, when I run cordova build --release android I get the following error:

:lintVitalArmv7Release
/Users/xxx/Documents/xxx/xxx/platforms/android/res/values/arrays.xml:3: Error: "country_codes" is not translated in "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "eu" (Basque), "fi" (Finnish), "fr" (French), "he" (Hebrew), "hi" (Hindi), "hu" (Hungarian), "id" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ko" (Korean), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sv" (Swedish), "tr" (Turkish), "zh-rCN" (Chinese: China), "zh-rTW" (Chinese: Taiwan, Province of China) [MissingTranslation]
  <string-array name="country_codes">
                ~~~~~~~~~~~~~~~~~~~~
/Users/xxx/Documents/xxx/xxx/platforms/android/res/values/strings.xml:3: Error: "app_name" is not translated in "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "eu" (Basque), "fi" (Finnish), "fr" (French), "he" (Hebrew), "hi" (Hindi), "hu" (Hungarian), "id" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ko" (Korean), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sv" (Swedish), "tr" (Turkish), "zh-rCN" (Chinese: China), "zh-rTW" (Chinese: Taiwan, Province of China) [MissingTranslation]
    <string name="app_name">myapp</string>
            ~~~~~~~~~~~~~~~
/Users/xxx/Documents/xxx/xxx/platforms/android/res/values/strings.xml:4: Error: "launcher_name" is not translated in "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "eu" (Basque), "fi" (Finnish), "fr" (French), "he" (Hebrew), "hi" (Hindi), "hu" (Hungarian), "id" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ko" (Korean), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sv" (Swedish), "tr" (Turkish), "zh-rCN" (Chinese: China), "zh-rTW" (Chinese: Taiwan, Province of China) [MissingTranslation]
    <string name="launcher_name">@string/app_name</string>
            ~~~~~~~~~~~~~~~~~~~~
/Users/xxx/Documents/xxx/xxx/platforms/android/res/values/strings.xml:5: Error: "activity_name" is not translated in "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "eu" (Basque), "fi" (Finnish), "fr" (French), "he" (Hebrew), "hi" (Hindi), "hu" (Hungarian), "id" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ko" (Korean), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sv" (Swedish), "tr" (Turkish), "zh-rCN" (Chinese: China), "zh-rTW" (Chinese: Taiwan, Province of China) [MissingTranslation]
    <string name="activity_name">@string/launcher_name</string>
            ~~~~~~~~~~~~~~~~~~~~

   Explanation for issues of type "MissingTranslation":
   If an application has more than one locale, then all the strings declared
   in one language should also be translated in all other languages.

   If the string should not be translated, you can add the attribute
   translatable="false" on the <string> element, or you can define all your
   non-translatable strings in a resource file called donottranslate.xml. Or,
   you can ignore the issue with a tools:ignore="MissingTranslation"
   attribute.

   By default this detector allows regions of a language to just provide a
   subset of the strings and fall back to the standard language strings. You
   can require all regions to provide a full translation by setting the
   environment variable ANDROID_LINT_COMPLETE_REGIONS.

   You can tell lint (and other tools) which language is the default language
   in your res/values/ folder by specifying tools:locale="languageCode" for
   the root <resources> element in your resource file. (The tools prefix
   refers to the namespace declaration http://schemas.android.com/tools.)

/Users/xxx/Documents/xxx/xxx/platforms/android/res/values-ar/strings.xml:64: Error: "menu_settings" is translated here but not found in default locale [ExtraTranslation]
  <string name="menu_settings">???????</string>
    5 errors, 0 warnings
    :lintVitalArmv7Release FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':lintVitalArmv7Release'.
    > Lint found fatal errors while assembling a release target.

      To proceed, either fix the issues identified by lint, or modify your build script as follows:
      ...
      android {
          lintOptions {
              checkReleaseBuilds false
              // Or, if you prefer, you can continue to check for errors in release builds,
              // but continue the build even when errors are found:
              abortOnError false
          }
      }
      ...

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED

    Total time: 4.583 secs

    /Users/xxx/Documents/xxx/xxx/platforms/android/cordova/node_modules/q/q.js:126
                        throw e;
                              ^
    Error code 1 for command: /Users/xxx/Documents/xxx/xxx/platforms/android/gradlew with args: cdvBuildRelease,-b,/Users/xxx/Documents/xxx/xxx/platforms/android/build.gradle,-Dorg.gradle.daemon=true
    ERROR building one of the platforms: Error: /Users/xxx/Documents/xxx/xxx/platforms/android/cordova/build: Command failed with exit code 8
    You may not have the required environment or OS to build this project
    Error: /Users/xxx/Documents/xxx/xxx/platforms/android/cordova/build: Command failed with exit code 8
        at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
        at ChildProcess.emit (events.js:98:17)
        at maybeClose (child_process.js:766:16)
        at Process.ChildProcess._handle.onexit (child_process.js:833:5)

I can run ionic build android and deploy to an emulator without problem.

I've tried searching for lintOptions and build.gradle but I can't find them anywhere in my project...

Can anyone help? Thanks in advance

3
  • 1
    You should find build.gradle in /platforms/android/. Try adding the suggested option and re-run. Commented May 20, 2015 at 15:36
  • I have the same problem here ... Any idea whats going on? Commented May 26, 2015 at 14:12
  • If below solutions do not work, check stackoverflow.com/questions/17020298/… Commented Feb 14, 2016 at 13:08

8 Answers 8

39

Solved this by adding

lintOptions {
    abortOnError false
}

to the android {} section in /platforms/android/build.gradle

Sign up to request clarification or add additional context in comments.

5 Comments

better still, rather than editing build.grade, add a new file called build-extras.gradle and put the following in: android { lintOptions { checkReleaseBuilds false } }
Dont have words to appreciate my friend.. Thanks a lot
Anyone know how to do this in Phonegap Build config file?
Take a look at @gustavohenke answer: ignore-lint-translation
That's actually bad advise. It's like if you fail your yearly car safety test and decide to solve the problem by not going anymore
34

Add the following entry to the /platforms/android/build.gradle file in your Ionic project:

android {
   lintOptions { disable 'MissingTranslation', 'ExtraTranslation' }
}

worked.

3 Comments

Much better option than entirely disabling error checks
Thanks a lot mate.. It worked!! but hope this won't affect anything else and reliable solution :P
Please correct, disable 'MissingTranslation' disable 'ExtraTranslation'
15

For those who prefer to keep platforms directory out of the VCS (Git, etc),
the best solution at the moment is to use a plugin called ignore-lint-translation.

cordova plugin add cordova-plugin-ignore-lint-translation --save

The effective result is the addition of a gradle file that will disable such lint options (doh!).

1 Comment

Cordova supports build-extras.gradle, this doesn't need to be pulled into it's own file, simply copy the build-extras.gradle into the platform directory. This is the advice most readily available in the documentation.
7

One can be more specific by just adding

lintOptions {
    disable MissingTranslation
}

2 Comments

I found I needed to add lintOptions { disable 'MissingTranslation' disable 'ExtraTranslation' } (on separate lines obviously)
That seems better to me: Lint can be useful for other things.
5

To fixed this error you should add

lintOptions {
    checkReleaseBuilds false
    // Or, if you prefer, you can continue to check for errors in release builds,
    // but continue the build even when errors are found:
    abortOnError false
}

In android {} section in /platforms/android/build.gradle

1 Comment

That's actually bad advise. It's like if you fail your yearly car safety test and decide to solve the problem by not going anymore
2
echo "android { lintOptions { checkReleaseBuilds false } }" >> platforms/android/build-extras.gradle

Comments

0

No need to use a cordova plugin, use an after_platform_add hook as described here, then put the following in a build-extras.gradle file:

android {
    lintOptions {
        disable 'MissingTranslation'
        disable 'ExtraTranslation'
    }
}

Comments

0

If your build failed because of MissingTranslation issues, and if the string should not be translated, you can add the attribute translatable="false" on that <string> element in /platforms/android/app/src/main/res/values/strings.xml file.

So, if the strings in the strings.xml file is like this:

<string name="app_name">Your App Name</string>
<string name="launcher_name">@string/app_name</string>
<string name="activity_name">@string/launcher_name</string>

Edit them to look like this:

<string name="app_name" translatable="false">Your App Name</string>
<string name="launcher_name" translatable="false">@string/app_name</string>
<string name="activity_name" translatable="false">@string/launcher_name</string>

This solution worked for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.