5

There was some update to the XML resource file for ES Strings. After the changes with these String the Build fails with below error:

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

The error states that issue is with Superscript char \u00b3, however, I have not added this in the resource file.

To debug this issue, I run Gradlew directly from terminal with stacktrace, which give the below details:

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

Could anyone please suggest on how this can be fixed, any ideas!

InsaneCat
  • 2,115
  • 5
  • 21
  • 40
Timson
  • 1,337
  • 3
  • 19
  • 32

2 Answers2

0

You say:

There was some update to the XML resource file for ES Strings. After the changes with these String the Build fails with below error:

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

What's happening

In your Spanish res/values-es/strings.xml file you have a unicode charachter,
(U+00B3) ('SUPERSCRIPT THREE') at line 5563, column 57.

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

How to fix it (general fix)

This is how you encode that character in strings.xml (&#x00b3):

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

How to fix it (specific)

It is not clear how or why you are using com.github.javaparser to process your resource strings instead of the default (as I know it) XmlPullParser (you have not shared your build.gradle file's). It is clear you are using an old (with known bugs in this area) version. To upgrade:

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

Links

See Special-characters-in-your-XML.

Jon Goodwin
  • 9,053
  • 5
  • 35
  • 54
0

This issue was previously reported a as bug:

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

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

This issues were closed and fixed in the last version:

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

Upgrade to the latest version!

Jorgesys
  • 124,308
  • 23
  • 334
  • 268