Gradle Build error for task "processBasicDebugResources": com.github.javaparser.TokenMgrError

An update has appeared in the XML resource file for ES Strings. After changes with these lines, the line will end with the error below:

Error:com.github.javaparser.TokenMgrError: Lexical error at line 5563, column 57. Encountered: "\u00b3" (179), after : "" 

The error indicates that the problem is with Superscript char \ u00b3, however I did not add this to the resource file.

To debug this problem, I run Gradlew directly from the terminal using stacktrace, which give the following data:

 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 

Can anyone suggest how this can be fixed, any ideas!

+5
source share
2 answers

You speak:

The XML file indicated some update for ES Strings. After changing with these lines, the line ends with the error below:

 Error:com.github.javaparser.TokenMgrError: Lexical error at line 5563, column 57. Encountered: "\u00b3" (179), after : "" 

What's happening

Your spanish res/values-es/strings.xml file has a unicode charachter ,
(U + 00B3) ("SUPERSCRIPT THREE") at line 5563, column 57.

(Remember that the Android resource file strings.xml UTF-8 is encoded).

How to fix it (general fix)

This is how you encode this character in strings.xml ( ³ ):

  <string name="SUPERSCRIPT THREE">&#x00b3</string> 

How to fix it (specific)

It's unclear how or why you use com.github.javaparser to process your resource strings instead of the default (as I know it) XmlPullParser (you did not share the build.gradle files). It is clear that you are using the old version (with known bugs in this area). To update:

 dependencies { compile 'com.github.javaparser:javaparser-core:3.5.5' } 

References

See Special-characters-in-your-XML .

0
source

This issue was previously reported as an error:

https://netbeans.org/bugzilla/show_bug.cgi?id=270350

but this error is caused by Unicode characters like "\ u00b3"

These issues were closed and fixed in the latest version:

https://github.com/javaparser/javaparser/issues/1159 https://github.com/javaparser/javaparser/issues/404 https://github.com/javaparser/javaparser/pull/411

Go to the latest version!

0
source

Source: https://habr.com/ru/post/1273790/


All Articles