The problem is odd. I'm trying to add a String directly in build.gradle
because I need it to use Tray library (https://github.com/grandcentrix/tray). In my first project everything went fine. In the second project it's a little bit more complicated. I'm using gradle:1.2.3
and while exporting signed apk there is a MissingTranslation error.
build.gradle
applicationId "some.app.id"
resValue "string", "tray__authority", "${applicationId}.tray"
build error
.../build/generated/res/generated/release/values/generated.xml
Error:(7) Error: "tray__authority" is not translated in "pl" (Polish) [MissingTranslation]
<string name="tray__authority">some.app.id.tray</string>
generated.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Automatically generated file. DO NOT MODIFY -->
<!-- Values from default config. -->
<string name="tray__authority">some.app.id.tray</string>
</resources>
There are a few similar questions but all of them are related to strings.xml and it's suggested to
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
or just translatable="false"
I cannot do it because the file is auto-generated. How can I force gradle to ignore the error? I tried to change inspection settings and make it a warning but gradle is ignoring my settings.
I know it's a bug (https://code.google.com/p/android/issues/detail?id=152198) but I don't know how to resolve it. All the answers I found don't work.
Well, I solved this. It has to be said that the error is strange. It never appeared before, only the latest gradle version has the problem. I found out that generating a signed apk ignores our inspection settings (Android Studio) and it's impossible to generate a production release.
Just ignore it in the right place! Here: build.gradle
android {
// defaultConfig, buildTypes, etc.
lintOptions {
disable 'MissingTranslation'
}
}
The solution should be used with awareness that all the missing translations will be just ignored so I recommend to comment it, double check what is missing and finally uncomment it when everything is as intended ;)
I hope it helped somebody. Very annoying thing.
In Android Studio, go to Settings/Inspections/Android lint, in the search box type "missingtranslation", then select "info" instead of "error" on the lower right. Or uncheck the thing altogether.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With