Android Studio:打包时出现xxx is not translated in xx

在某项目里用到了友盟的SDK,在打正式包时,友盟sdk里的很多资源文件编译出错,报错信息如下:

Error:(23) Error: "com_facebook_like_button_not_liked" is not translated in "ar" (Arabic), "cs" (Czech), "de" (German), "es" (Spanish), "fi" (Finnish), "fr" (French), "he" (Hebrew), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ko" (Korean), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "pt-BR" (Portuguese: Brazil), "ro" (Romanian), "ru" (Russian), "zh" (Chinese) [MissingTranslation]
...

但其实最后apk也打出来了,虽然不知道为什么报错了还是能输出apk,但是还要想解决这个问题,经过搜索,找到以下解决方案。

解决方案一:

在字符串资源文件里将string结点添加一个属性translatable="false",这种方法只适合数量较少的情况下。

解决方案二:

是用tools:ignore="MissingTranslation“ 属性直接忽略这个问题。在字符资源文件里根结点resource中下添加这么两个属性,就可以了
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation"。例:



  WhatsApp

解决方案三:

在项目的builde.gralde里添加如下代码

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
  }
}

参考资料

  • http://blog.163.com/shexinyang@126/blog/static/136739312201492144928812/
  • http://www.cnblogs.com/qinxianyuzou/p/3941661.html
  • https://segmentfault.com/a/1190000000599530

你可能感兴趣的:(Android Studio:打包时出现xxx is not translated in xx)