使用Android Studio生成签名APK时构建失败

时间:2015-06-25 13:04:01

标签: android android-studio

当我尝试构建项目时,发生了以下错误:

    Error: "mail_subtitle" is translated here but not found in default locale [ExtraTranslation]
    Error: "login_subtitle" is translated here but not found in default locale [ExtraTranslation]
    Error: "password_subtitle" is translated here but not found in default locale [ExtraTranslation]
            ~~~~~~~~~~~~~~~~~~~~~
    /xxxxxx/src/main/res/values-es/strings.xml:336: Also translated here
   Explanation for issues of type "ExtraTranslation":
   If a string appears in a specific language translation file, but there is
   no corresponding string in the default locale, then this string is probably
   unused. (It's technically possible that your application is only intended
   to run in a specific locale, but it's still a good idea to provide a
   fallback.).
   Note that these strings can lead to crashes if the string is looked up on
   any locale not providing a translation, so it's important to clean them
   up.

  > Lint found fatal errors while assembling a release target.
  To proceed, either fix the issues identified by lint, or modify your build script as follows:
  ...
  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
      }
  }
  ...

好的,我知道错误是因为我已经翻译了字符串(西班牙语和葡萄牙语),但我没有默认翻译。问题是我的默认翻译是在我的库中而不是在这个项目中。

整个项目的结构需要如下所述:图书馆内的默认翻译和其他项目内的翻译。所有使用这些字符串的类都在库中,翻译在使用该库的项目中,因为我需要为我构建的每个项目进行不同的翻译。

Android Studio建议使用lintOptions" abortOnError false"但我不想使用这个标志,我想知道当我发生错误时,我只是不想看到这个特定的错误。

1 个答案:

答案 0 :(得分:1)

尝试在/src/main/res/values/strings.xml等默认值文件夹中添加strings.xml吗?

然后以默认语言添加3个缺失的字符串。