mikepenz / MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
https://mikepenz.dev
Apache License 2.0
11.68k stars 2.05k forks source link

java.lang.NoSuchMethodError: No virtual method withIdDistributor #2527

Closed gmgunderground closed 4 years ago

gmgunderground commented 4 years ago

Hi I have the following eror

java.lang.NoSuchMethodError: No virtual method withIdDistributor

and I don't know why, as described in documentation using Java and AndroidX i have used implementation "com.mikepenz:materialdrawer:6.1.2" and all the other requirements.

Stack trace is the following

    java.lang.NoSuchMethodError: No virtual method withIdDistributor(Lcom/mikepenz/fastadapter/IIdDistributor;)Lcom/mikepenz/fastadapter/adapters/ModelAdapter; in class Lcom/mikepenz/fastadapter/adapters/ItemAdapter; or its super classes (declaration of 'com.mikepenz.fastadapter.adapters.ItemAdapter' appears in /data/app/it.gmg.android.alfa-P3nNRgk1T1Wj7zaYG8VomA==/base.apk!classes2.dex)
        at com.mikepenz.materialdrawer.DrawerBuilder.<init>(DrawerBuilder.java:875)
        at it.gmg.android.alfa.MainActivity.initDrawer(MainActivity.java:627)
        at it.gmg.android.alfa.MainActivity.onCreate(MainActivity.java:345)
        at android.app.Activity.performCreate(Activity.java:7815)
        at android.app.Activity.performCreate(Activity.java:7804)

I'm not able to identify the problem, the code seams to be correct

        drawer = new DrawerBuilder()
                .withActivity(this)
                .withSelectedItem(-1)
                .withCloseOnClick(true)
                .build();

Best regards

mikepenz commented 4 years ago

Which version of the FastAdapter are you using? @gmgunderground

gmgunderground commented 4 years ago
    implementation 'com.mikepenz:fastadapter:3.3.1'
    implementation 'com.mikepenz:fastadapter-commons:3.3.1'
    implementation 'com.mikepenz:fastadapter-extensions:3.3.1'
    implementation 'com.mikepenz:materialize:1.2.1'

Tell me if you need more info

mikepenz commented 4 years ago

Are you sure? the issue looks somehow that a different version is used

gmgunderground commented 4 years ago

Yes, this is the full dependencies part of the gradle file

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.mikepenz:materialdrawer:6.1.2"
    implementation "com.google.android.material:material:1.0.0"
    //noinspection GradleCompatible
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.ogaclejapan.smarttablayout:library:2.0.0'
    implementation 'com.ogaclejapan.smarttablayout:utils-v4:2.0.0'
    implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    //implementation 'com.github.iammert:MaterialIntroView:1.6.0'
    implementation 'com.github.iammert:MaterialIntroView:f7b36b7'

    //implementation 'com.squareup.okhttp3:okhttp:4.0.0-alpha01'
    implementation 'com.squareup.okhttp3:okhttp:3.12.1' // Non cambiare versione per compatibilità con android 4

    implementation 'com.mikepenz:aboutlibraries:7.0.4'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    implementation 'com.github.gabrielemariotti.changeloglib:changelog:2.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'org.apache.commons:commons-lang3:3.9'
    implementation project(':dashboard')
    implementation 'com.github.AndroidDeveloperLB:AutoFitTextView:4'
    implementation 'com.heinrichreimersoftware:material-intro:7221502'
    implementation 'io.github.kobakei:ratethisapp:1.2.0'

    implementation 'org.slf4j:slf4j-api:1.7.25'
    implementation 'com.github.tony19:logback-android:2.0.0'

    /*
    implementation 'org.slf4j:slf4j-api:1.8.0-beta4'
    implementation 'com.github.tony19:logback-android-core:1.1.1-6'
    implementation('com.github.tony19:logback-android-classic:1.1.1-6') {
        // workaround issue #73
        exclude group: 'com.google.android', module: 'android'
    }
    */

    //compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
    implementation 'com.github.lecho:hellocharts-library:1.5.8'

    implementation 'com.mikepenz:fastadapter:3.3.1'
    implementation 'com.mikepenz:fastadapter-commons:3.3.1'
    implementation 'com.mikepenz:fastadapter-extensions:3.3.1'
    implementation 'com.mikepenz:materialize:1.2.1'

    dependencies {
        implementation 'com.jakewharton:butterknife:10.1.0'
        annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
    }

    //https://github.com/GrenderG/Toasty
    implementation 'com.github.GrenderG:Toasty:1.2.8'
}
mikepenz commented 4 years ago

@gmgunderground AboutLibraries v7 uses FastAdapter 4.x https://github.com/mikepenz/AboutLibraries/blob/develop/build.gradle#L24

This results in a conflict of versions.

AboutLibraries 6.2.3 is using FastAdapter 3.x and will fix your issue

gmgunderground commented 4 years ago

Yes, you are right that's the problem!

Thank you very much