How to sign APK on Android Studio even with non-translated strings?

android developer picture android developer · Dec 14, 2014 · Viewed 34.5k times · Source

Background

I've recently migrated my app to Android-Studio. I had some issues doing so, but I got over them eventually.

The problem

For some reason, on Android Studio, when I try to sign an APK, I get a lot of errors that look like this:

Error:(16) Error: "..." is not translated in "de" (German), "el" (Greek), "iw" (Hebrew) [MissingTranslation]

(where "..." is a string)

At the bottom, after a lot of errors of this kind, I see this:

Error:Execution failed for task ':app:lintVitalRelease'.
> 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
    }
}
...

The question

I'm not sure what's wrong and how I can fix it. On Eclipse I did it very easily. Missing translations shouldn't stop me from signing an APK...

To me it seems as if Lint is preventing the exporting of the APK, and that the reason is that I didn't translate all of the strings. Is that true?

Can anyone please help me? How can I fix this, so that Lint will show me just warnings instead? or a confirmation dialog if I'm sure I want to do it?

Answer

yvolk picture yvolk · Aug 5, 2015

The cleanest way to solve the problem is to disable Lint checks of missing translations for release builds only.

To do so add "disable 'MissingTranslation'" to your build.gradle file as shown below:

android {
    buildTypes {
        release {
            lintOptions {
                disable 'MissingTranslation'
            }
        }
    }
}