ES Strings的XML资源文件有一些更新。使用这些String进行更改后,Build失败并显示以下错误:
Error:com.github.javaparser.TokenMgrError: Lexical error at line 5563, column 57. Encountered: "\u00b3" (179), after : ""
该错误表明该问题与Superscript char \ u00b3有关,但是,我没有在资源文件中添加它。
要调试此问题,我使用stacktrace直接从终端运行Gradlew,它提供了以下详细信息:
Caused by: com.github.javaparser.TokenMgrError: Lexical error at line 5563, column 57. Encountered: "\u00b3" (179), after : ""
at com.github.javaparser.ASTParserTokenManager.getNextToken(ASTParserTokenManager.java:2480)
at com.github.javaparser.ASTParser.jj_scan_token(ASTParser.java:9115)
at com.github.javaparser.ASTParser.jj_3R_92(ASTParser.java:5504)
at com.github.javaparser.ASTParser.jj_3_5(ASTParser.java:5574)
at com.github.javaparser.ASTParser.jj_2_5(ASTParser.java:5198)
at com.github.javaparser.ASTParser.ClassOrInterfaceBodyDeclaration(ASTParser.java:944)
at com.github.javaparser.ASTParser.ClassOrInterfaceBody(ASTParser.java:865)
at com.github.javaparser.ASTParser.ClassOrInterfaceDeclaration(ASTParser.java:470)
at com.github.javaparser.ASTParser.ClassOrInterfaceBodyDeclaration(ASTParser.java:932)
at com.github.javaparser.ASTParser.ClassOrInterfaceBody(ASTParser.java:865)
at com.github.javaparser.ASTParser.ClassOrInterfaceDeclaration(ASTParser.java:470)
at com.github.javaparser.ASTParser.TypeDeclaration(ASTParser.java:398)
at com.github.javaparser.ASTParser.CompilationUnit(ASTParser.java:203)
at com.github.javaparser.JavaParser.parse(JavaParser.java:111)
at com.github.javaparser.JavaParser.parse(JavaParser.java:158)
at com.github.javaparser.JavaParser.parse(JavaParser.java:177)
at butterknife.plugin.FinalRClassBuilder.brewJava(FinalRClassBuilder.java:36)
at butterknife.plugin.FinalRClassBuilder$brewJava.call(Unknown Source)
at butterknife.plugin.ButterKnifePlugin$_apply_closure1$_closure2$_closure3$_closure4.doCall(ButterKnifePlugin.groovy:34)
at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:596)
at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:577)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
... 70 more
任何人都可以建议如何解决这个问题,任何想法!
答案 0 :(得分:0)
你说:
XML
字符串的ES
资源文件有一些更新。后 使用这些String的更改构建失败,并显示以下错误:
Error:com.github.javaparser.TokenMgrError: Lexical error at line 5563, column 57. Encountered: "\u00b3" (179), after : ""
在西班牙语 res/values-es/strings.xml
文件中,您有unicode charachter
,
(U + 00B3)(' SUPERSCRIPT THREE')第5563行,第57栏。
(请记住,Android
strings.xml
资源文件是UTF-8编码的。
这是您在strings.xml
(³
)中对该字符进行编码的方式:
<string name="SUPERSCRIPT THREE">³</string>
目前尚不清楚使用com.github.javaparser处理资源字符串的方式或原因,而非默认情况(我知道)XmlPullParser(您尚未共享build.gradle
文件& #39; S)。很明显,您使用的是旧版本(此区域已知错误)版本。要升级:
dependencies {
compile 'com.github.javaparser:javaparser-core:3.5.5'
}
答案 1 :(得分:0)
此问题之前曾报告为错误:
https://netbeans.org/bugzilla/show_bug.cgi?id=270350
但此错误是由"\u00b3"
等unicode字符引起的此问题已在上一版本中关闭并修复:
https://github.com/javaparser/javaparser/issues/1159 https://github.com/javaparser/javaparser/issues/404 https://github.com/javaparser/javaparser/pull/411
升级到最新版本!