Android Lint limit languages to check for missing translations

Update: You can limit the languages that are imported by Gradle!
Cyril Mottier points out that you can specify which resources you support.

Starting Android Gradle Plugin 0.7, you can pass information about the configurations your application deals with to the build system. This is done thanks to the resConfig and resConfigs flavor and default config option. The DSL below prevents aapt from packaging resources that don’t match the app managed resources configurations:

defaultConfig {
    // ...
    resConfigs "en", "de", "fr", "it"
}

More info here Putting Your APKs on Diet and Android (search for resConfig on the page)


It appears that if you add a project to your build path, any and all languages that have been added to those projects will trickle down into your project. Such as the “google-play-services_lib” project, which added a good 40+ languages to my project that I “supported”. This was the reason I got the crazy lint errors (similar to yours above), even though I only had a default and Spanish (values-es) resource folder.

The solution is to simply delete the resource files/folders that you are not supporting from the external/imported projects. After I deleted all but the values/values-es folder in the google-play-services_lib project, the lint warnings went away for the non-target languages. Be sure to keep a backup of the resource files in case you feel like adding support for those languages/regions at a later date.

Hope this helps. I was banging my head on the table and all over SO and Google for a few days trying to figure out how to phrase the problem. Then I finally realized what the difference was between my two projects that both had translations, the library projects.

I do wish there was a way to tell the project that I only support languages x/y/z and have it ignore the rest.

Leave a Comment