android studio 打包報 MissingTranslation 的 3種解決方式

早上用Android studio打包生成android apk的時候遇到了編譯問題,明明沒有想要做英文翻譯,但是AS生成apk的時候自己走了translate in english的路線。

幾個string.xml文件報錯 string value is not translated in "zh"(Chinese)[MissingTranslation]。


通過查找解決方案,發現有三種方案可以解決:

1、 在string 里加attribute      translatable="false":

<string name="hello_world" translatable="false">你好</string>

2、直接設定 string.xml文件內的resources的attribute:

<resources
   xmlns:tools="http://schemas.android.com/tools"
   tools:ignore="MissingTranslation">
    <string name="hello_world">你好</string>
</resources>

3、 File-->Setting-->Editor下的Inspections-->Android Lint 下的 Incomplete translation勾選去掉(不是很推薦,這是在google上找到的一種方法,試了一下不可以)




發佈了75 篇原創文章 · 獲贊 144 · 訪問量 45萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章