Gradle错误:无法编码的字符无法编码UTF-8

时间:2018-09-27 09:12:40

标签: android android-gradle build.gradle

在应用程序的build.gradle中添加实施项目(':mylibrary')会产生以下错误。

:mylibrary:generateDebugSources
                \generated\source\r\debug\myapp\example\com\mylibrary\R.java:775: error: unmappable character for encoding UTF-8
    public static int alternates_for_albanian_� = 0x7f15001e;                                                                  
                                               ^
                \build\generated\source\r\debug\myapp\example\com\mylibrary\R.java:775: error: illegal character: '\ufffd'
    public static int alternates_for_albanian_? = 0x7f15001e;
                                              ^
    1 error

    :mylibrary:compileDebugJavaWithJavac FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':mylibrary:compileDebugJavaWithJavac'.

但是,如果我们直接在应用程序的资源文件中使用相同的字符串,则在将这个字符串语句移至库模块资源文件中然后在应用程序的build.gradle中添加库编译依赖项后,就不会收到此错误。文件,它给我显示了无法映射的字符的错误。

0 个答案:

没有答案