Gradle Antlr4 Plugin In Android App: Build Fails
I spent few days spotting this issue, and I'd like to post my finding here. I'm building an Android app with several modules, one of them using ANTLR plugin. While the module with
Solution 1:
My solution was to remove duplicate dependencies:
apply plugin: 'antlr'
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.7
targetCompatibility = 1.7finalGENERATED_MAIN="src-gen/main/java"finalGENERATED_TEST="src-gen/test/java"
sourceSets {
main {
java { srcDirs += [GENERATED_MAIN] }
}
main {
java { srcDirs += [GENERATED_TEST] }
}
}
repositories {
mavenCentral()
}
dependencies {
antlr("org.antlr:antlr4:4.5") {
exclude group: 'org.antlr', module:'antlr-runtime'
exclude group: 'org.antlr', module:'antlr4-runtime'
exclude group: 'org.antlr', module:'ST4'// just in case :-)
}
compile ('com.yuvalshavit:antlr-denter:1.0') {
// denter library also has dependency on antlr4-runtime ...
exclude group: 'org.antlr', module:'antlr4-runtime'
}
testCompile group: 'junit', name: 'junit', version:'4.11'
}
...
I'm open for any better solution you can suggest - I'm not good with gradle.
Post a Comment for "Gradle Antlr4 Plugin In Android App: Build Fails"