question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ANTLR Tool version 4.7.2 used for code generation does not match the current runtime version 4.5.3

See original GitHub issue

Issue Description

Trying to use the Gradle plugin in one of my project, created a separate module for GraphQL codegen. Everytime when I run graphqlCodegen it’s fail with an error:

ANTLR Tool version 4.7.2 used for code generation does not match the current runtime version 4.5.3

Caused by: java.lang.UnsupportedOperationException: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with UUID 59627784-3be5-417a-b9eb-8131a7286089 (expected aadb8d7e-aeef-4415-ad2b-8204d6cf042e or a legacy UUID).
        at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:153)
        at graphql.parser.antlr.GraphqlLexer.<clinit>(GraphqlLexer.java:276)

Steps to Reproduce

  1. git clone git@github.com:expatiat/dumper.git
  2. cd dumper/dumper-api-interface
  3. ../gradlew clean graphqlCodegen --info --stacktrace

Your Environment and Setup

  • graphql-java-codegen version: 4.1.5
  • Build tool: Gradle 6.8.3
  • Mapping Config: E.g.:
plugins {
    `java-library`
    id("io.github.kobylynskyi.graphql.codegen") version "4.1.5"
}

tasks.named<io.github.kobylynskyi.graphql.codegen.gradle.GraphQLCodegenGradleTask>("graphqlCodegen") {
    graphqlSchemaPaths = listOf(
        "$projectDir/../dumper-api/src/main/resources/graphql/dumper.graphqls",
        "$projectDir/../dumper-api/src/main/resources/graphql/include/dumper-enums.graphqls",
        "$projectDir/../dumper-api/src/main/resources/graphql/include/dumper-errors.graphqls",
        "$projectDir/../dumper-api/src/main/resources/graphql/include/dumper-inputs.graphqls",
        "$projectDir/../dumper-api/src/main/resources/graphql/include/dumper-payloads.graphqls",
        "$projectDir/../dumper-api/src/main/resources/graphql/include/dumper-types.graphqls"
    )
    outputDir = File("$buildDir/generated")
    packageName = "com.example.graphql.model"
}

sourceSets {
    getByName("main").java.srcDirs("$buildDir/generated")
}

tasks.named<JavaCompile>("compileJava") {
    dependsOn("graphqlCodegen")
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
donbeavecommented, Mar 30, 2021

Hi, @kobylynskyi!

I found the reason why I’m getting this error. The error came after I’m adding the Gradle Kotlin JVM plugin.

When I add this to plugins:

kotlin("jvm") version "1.4.31" apply false

I’m starting to get this error:

ANTLR Tool version 4.7.2 used for code generation does not match the current runtime version 4.5.2ANTLR Runtime version 4.7.2 used for parser compilation does not match the current runtime version 4.5.2
FAILURE: Build failed with an exception.

I have tried with the latest Kotlin plugin and it works fine, no exception:

kotlin("jvm") version "1.5.0-M2" apply false
0reactions
clouddracommented, Apr 7, 2021

@clouddra maybe you have the Apollo Gradle plugin? It can be another Gradle plugin that also uses ANTLR Tool, I found Kotlin and Apollo plugins are using it.

Yes that was what i found while debugging it. The 5.0.0 release should fix it since Apollo ANTLR is on a later version. Thanks for the advise.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ANTLR Tool version 4.5.3 used for code generation does ...
This is a known problem with some databinding versions (which is embedded in Android Studio) and other dependencies like Room which import ...
Read more >
ANTLR Tool version 4.5.3 does not match the current ...
hello: i'm using antlr-4.6-complete.jar in my project, but the console show the logs below: ANTLR Tool version 4.5.3 used for code ...
Read more >
ANTLR Tool version 4.7.2 used for code generation does ...
Native Build - ANTLR Tool version 4.7. 2 used for code generation does not match the current runtime version 4.8.
Read more >
ANTLR Tool version mismatch with Room build error
ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1ANTLR Runtime version 4.5.3 used for parser compilation ......
Read more >
ANTLR Tool version 4.5.3 used for code generation does not ...
Android : ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1 [ Beautify Your Computer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found