跳到主要內容

發表文章

目前顯示的是 2015的文章

避免 Android Studio 輸出 APK 時出現 [MissingTranslation] 的問題

最近在用 Android Studio 輸出 Signed APK 時遇到了以下錯誤: Error: "xxx" is not translated in ... [MissingTranslation] 原因是 Lint 檢查到某些字串沒有被翻譯所導致。但有些字串就是不需、不想或懶得翻譯時該怎麼辦呢? 方法有以下幾種: 1.對不需翻譯的字串加上 translatable="false" <string name="xxx" translatable="false">"XXX"</string> 2.在 strings.xml 的 resources 加上以下屬性 <resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation" > 3.在 app/build.gradle 中加上以下設定 android { ... lintOptions { disable 'MissingTranslation' } ... } 或 android { ... lintOptions { checkReleaseBuilds false abortOnError false } ... } 參考資料: http://blog.csdn.net/KjunChen/article/details/50043487