1

In Android Studio the debug build compiles and runs without any problems. When we do a release build on our build machine however, it fails the build because of translation strings that are missing.

Log gives

strings.xml:30: Error: "OrderFilterHint" is not translated in "es" (Spanish), "pt" (Portuguese) [MissingTranslation]

I want these errors to appear on debug builds so developers can pick it up before breaking the release build.

I have tried editing lint.xml to this:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="MissingTranslation" severity="error" />
</lint>

and adding the following to my build.gradle

android {
 ...
    lintOptions {
        checkReleaseBuilds true
        enable 'MissingTranslation'
    }
}

None of the above seems to have helped.

How can I force the MissingTranslation lint check to fail my debug builds?

Diederik
  • 5,536
  • 3
  • 44
  • 60

1 Answers1

0

With gradle, it is generally ideal to use the lintOptions since it lets you fine tune warnings/errors as well as changing severity. From the lint options user-guide, you can add error 'MissingTranslation' to the lintOptions section.

Edit: If you want check/lint to be run when calling assembleDebug you can make the task depend on it.

e.g: add the following to gradle

assembleDebug.dependsOn lint
Nagesh Susarla
  • 1,660
  • 10
  • 10
  • Thanks for the answer, but this doesn't solve my problem. The lint check is only run when I run a `:check:` gradle build. http://stackoverflow.com/a/27068675/8524 – Diederik Sep 01 '15 at 10:53
  • updated the answer w/ a dependsOn task which can ensure that lint is run while running assembleDebug. Is that what you were looking for? – Nagesh Susarla Sep 02 '15 at 23:28