Search code examples
androidkotlinparsingantlr4

How to use AntlrV4 in Android Project


I cannot seem to get antlr4 working in my android Project, when using the Antlr4 plugin for intellij. When assigning the lexer to a val it throws this error

Could not deserialize ATN with version 4 (expected 3).

I'm also importing the Antlr4 runtime in my build.gradle v4.9 iirc. The Antlr4 plugin says it's v4.12? Could that be the issue? I was thrown off when it said expected 3. Should it not be generating V4 lexer and parser with the plugin? I'm very new to Antlr and Google hasn't been fruitful in my search to solve this.


Solution

  • Thanks to kaby76, the versions were indeed the problem. the plugin is 4.12, so updating the implementation to implementation "org.antlr:antlr4-runtime:4.12.0" did the trick