Skip to content

graphql-java on android: DexException #4

Closed

Description

@andimarek

Reported by @parallelcross (via twitter)
"DexException: Multiple dex files define Lorg/abego/treelayout/Configuration$AlignmentInLevel;"

Activity

  1. andimarek commented on Aug 1, 2015

    @andimarek
    MemberAuthor

    @parallelcross Could you please try the latest development build '2015-08-01T00-17-47'? (How to include this in your project here: https://github.com/andimarek/graphql-java#development-build)

    I updated the dependency to antlr 4.5.1, which itself removed the unnecessary dependency to org.abego.treelayout. I hope this will fix your issue.

  2. parallelcross commented on Aug 1, 2015

    @parallelcross

    Thanks again. It says it can't find the dependency

    repositories {
            maven { url "http://dl.bintray.com/andimarek/graphql-java" }
    }
    
    dependencies {
           compile 'com.graphql-java:graphql-java:2015-08-01T00-17-47'`
    }
    
  3. parallelcross commented on Aug 1, 2015

    @parallelcross

    I did download the jar from bintray. I don't get the DexException anymore, but I do get:

    java.lang.NoClassDefFoundError: Failed resolution of: Lorg/slf4j/LoggerFactory;

  4. parallelcross commented on Aug 1, 2015

    @parallelcross

    I added the slf4j dependency and was able to get past the NoClassDefFoundError. I now get:

    java.lang.NoClassDefFoundError: graphql.parser.antlr.GraphqlLexer
                at graphql.parser.Parser.parseDocument(Parser.java:18)
                at graphql.GraphQL.execute(GraphQL.java:63)
                at graphql.GraphQL.execute(GraphQL.java:54)
                at graphql.GraphQL.execute(GraphQL.java:46)
                at graphql.GraphQL.execute(GraphQL.java:42)
                at providerbrowser.wellmatch.com.providerbrowser.MainActivity.onCreate(MainActivity.java:39)
                at android.app.Activity.performCreate(Activity.java:5990)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
                at android.app.ActivityThread.access$800(ActivityThread.java:151)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
                at android.os.Handler.dispatchMessage(Handler.java:102)
                at android.os.Looper.loop(Looper.java:135)
                at android.app.ActivityThread.main(ActivityThread.java:5254)
                at java.lang.reflect.Method.invoke(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:372)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
    
  5. andimarek commented on Aug 1, 2015

    @andimarek
    MemberAuthor

    There seems to be a typo in your dependencies statement:

    dependencies {
           compile 'com.graphql-java:graphql-java:2015-08-01T00-17-47'`
    }

    There is a "backtick character" at the end of the line.

    This should give you graphql-java, slf4j and the antlr-runtime jar.

    You need all three jar files to run graphql-java. A missing antlr-runtime might explain your last Exception.

  6. parallelcross commented on Aug 1, 2015

    @parallelcross

    Sorry, that was just me mis-typing the dependency, the back tick wasn't in my build.gradle. I still can't resolve the dependency.

    screen shot 2015-08-01 at 2 03 16 pm

  7. andimarek commented on Aug 1, 2015

    @andimarek
    MemberAuthor

    ok .... what error message do you get?

  8. andimarek commented on Aug 1, 2015

    @andimarek
    MemberAuthor

    I just realised that you of course also need mavenCentral() as repository.

    Do you have

    repositories {
        mavenCentral()
    }
    

    anywhere in your build file?

  9. parallelcross commented on Aug 1, 2015

    @parallelcross

    That did it. I was able to confirm the the library is working for me now. Thanks.

  10. andimarek commented on Aug 1, 2015

    @andimarek
    MemberAuthor

    Cool ... thanks a lot for your feedback. I also updated the README.

    I will close this issue. Please open a new one, if you have any other problems/feedback.

  11. IHNEL commented on Dec 2, 2016

    @IHNEL

    I got the same error although already set mavenCentral()
    `Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

    com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lorg/antlr/v4/runtime/ANTLRErrorListener;`

    If I set multiDexEnabled true, I got new error message:

    `Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

    com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/antlr/v4/runtime/ANTLRErrorListener.class`

  12. dminkovsky commented on Dec 2, 2016

    @dminkovsky
    Contributor
  13. IHNEL commented on Dec 2, 2016

    @IHNEL

    I use v2.2.0: compile 'com.graphql-java:graphql-java:2.2.0'

  14. dminkovsky commented on Dec 2, 2016

    @dminkovsky
    Contributor
  15. IHNEL commented on Dec 2, 2016

    @IHNEL

    I did google but no solution help. This is my full gradle:
    (I also put mavenCentral() on project level gradle ). I can sync the libraries without error, but I can't run the app.

    apply plugin: 'com.android.application'
    apply plugin: 'me.tatarka.retrolambda'
    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.0"
        defaultConfig {
            applicationId "photos.waldo.demo"
            minSdkVersion 16
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    dependencies {
        // general
        compile 'com.android.support:appcompat-v7:25.0.1'
        compile 'com.android.support:design:25.0.1'
    
        //GraphQL
        compile 'com.graphql-java:graphql-java:2.2.0'
    
        //reactive programming
        compile 'io.reactivex:rxandroid:1.2.1'
        compile 'io.reactivex:rxjava:1.1.6'
    
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        testCompile 'junit:junit:4.12'
    }
    
    ```
    
  16. IHNEL commented on Dec 2, 2016

    @IHNEL

    I fixed this by:
    compile('com.graphql-java:graphql-java:2.2.0') { exclude group: 'org.antlr' }

  17. dminkovsky commented on Dec 2, 2016

    @dminkovsky
    Contributor
  18. IHNEL commented on Dec 2, 2016

    @IHNEL

    Thanks
    Im really new on GraphQL, so many new things to learn. You guys did a great job.

  19. dminkovsky commented on Dec 5, 2016

    @dminkovsky
    Contributor

    Thank you!

  20. added 3 commits that reference this issue on Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions