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.

SLF4J and Realm 2.0.1

See original GitHub issue

Hello,

I just updated realm from an older version to 2.0.1. From here, I’m unable to have my app working. It seems to be the same bug as #3018 and #3043 :

In debug mode, app builds fine but crashes at launch with this error :

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/gradle/internal/logging/slf4j/OutputEventListenerBackedLoggerContext;
                                                                          at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:30)
                                                                          at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:27)


....


Caused by: java.lang.ClassNotFoundException: Didn't find class "org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext" on path: DexPathList[[dex file "/data/data/.../files/instant-run/dex/slice-volley_8dd6661e4587145ffb6c9879c222bc51d500f59b-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-twitter-text-1.13.0_73d58164894a99049dcfd4f340b714ec4dfff779-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-support-annotations-24.2.1_c6ee83d5ac5d11c34968a1fdeaa1c92ddb4169e1-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slf4j-api-1.7.12_8403b189700353d8954870a9ab4b928754b6726f-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-retrofit-mock-1.8.0_536419611962dc0f5a7dba16c5de9cbd3ffcc007-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-retrofit-1.8.0_66b3384cf917570f83f165d8fd59e737c65d8d49-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-realm-annotations-2.0.1_d5c759715192ab7f28772555b7c057574cf41796-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-protobuf-java-2.6.1_3d226d37e23b7f0c65ae825cf36e522dfb577471-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-picasso-2.5.2_1b2610b4fc0832caa7649b7ae564642090129b2b-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-netty-common-4.1.0.Beta5_067153349f28557a0254ff7129dc51e8ba45753b-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-netty-buffer-4.1.0.Beta5_bb5b00239d7f938d53f7b2af8f6fc4e60f2a0f3d-classes.dex", dex file "/data/data/.../
10-06 09:47:48.276 17605-17605/... D/Error: ERR: exClass=java.lang.ClassNotFoundException
10-06 09:47:48.276 17605-17605/... D/Error: ERR: exMsg=Didn't find class "org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext" on path: DexPathList[[dex file "/data/data/.../files/instant-run/dex/slice-volley_8dd6661e4587145ffb6c9879c222bc51d500f59b-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-twitter-text-1.13.0_73d58164894a99049dcfd4f340b714ec4dfff779-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-support-annotations-24.2.1_c6ee83d5ac5d11c34968a1fdeaa1c92ddb4169e1-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-slf4j-api-1.7.12_8403b189700353d8954870a9ab4b928754b6726f-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-retrofit-mock-1.8.0_536419611962dc0f5a7dba16c5de9cbd3ffcc007-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-retrofit-1.8.0_66b3384cf917570f83f165d8fd59e737c65d8d49-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-realm-annotations-2.0.1_d5c759715192ab7f28772555b7c057574cf41796-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-protobuf-java-2.6.1_3d226d37e23b7f0c65ae825cf36e522dfb577471-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-picasso-2.5.2_1b2610b4fc0832caa7649b7ae564642090129b2b-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-netty-common-4.1.0.Beta5_067153349f28557a0254ff7129dc51e8ba45753b-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-netty-buffer-4.1.0.Beta5_bb5b00239d7f938d53f7b2af8f6fc4e60f2a0f3d-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-net.danlew-android.joda-2.9.2_20414ec42e96fe4d2f49d22bba76f3b99e810184-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-me.leolin-ShortcutBadger-1.1.6_d59f8b5a23d0b47e2d707561f40f014d4983c997-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-library-2.4.0_265a2ac7e32367588cae5b6ff904496508213bc0-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-jul-to-slf4j-1.7.12_4ae047c43e83c396b289f783af72b206a1410606-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-jsr305-2.0.1_f098b5342d9eecf48cfd5cc82f41e5bca2267add-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-joda-time-2.9.2-no-tzdb_c56a9daa13ad90750ba344d6f2b040f34c61dc5b-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-javax.servlet-api-3.1.0_8f79d7ad58f4626ab26f0ae35222a1a350c347ea-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-io.underdark-underdark-1.0.10_731a34523f1f6497e067ede2b50c4fd6b2275467-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-io.realm-realm-android-library-2.0.1_6713d04e7feebf2ffade5b92941705ea3ab203d3-classes.dex", dex file "/data/data/.../files/instant-run/dex/slice-io.realm-androi
10-06 09:47:48.276 17605-17605/... D/Error: ERR: file=BaseDexClassLoader.java
10-06 09:47:48.276 17605-17605/... D/Error: ERR: class=dalvik.system.BaseDexClassLoader
10-06 09:47:48.276 17605-17605/... D/Error: ERR: method=findClass line=56
10-06 09:47:48.277 17605-17605/... D/Error: ERR: stack=java.lang.NoClassDefFoundError: Failed resolution of: Lorg/gradle/internal/logging/slf4j/OutputEventListenerBackedLoggerContext;
                                                                 at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:30)
                                                                 at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:27)

In release mode, app does not build :

Error:Gradle: Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Can't write [...\app\build\intermediates\transforms\proguard\release\jars\3\1f\main.jar] (Can't read [...\app\build\intermediates\transforms\RealmTransformer\release\folders\1\1\realm(;;;;;;**/*.class)] (Duplicate zip entry [org/slf4j/impl/StaticLoggerBinder.class]))

Here is my messy build.gradle :

apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'

repositories {
    jcenter()
    maven {
        url 'https://maven.fabric.io/public'
    }
    maven {
        url 'https://dl.bintray.com/underdark/android/'
    }
    maven {
        url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
    }
}

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"


    defaultConfig {
        applicationId "..."
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 5
        versionName "1.1"
        generatedDensities = []
        multiDexEnabled true
    }

    aaptOptions {
        additionalParameters "--no-version-vectors"
    }

    lintOptions {
        abortOnError false
    }

    signingConfigs {
        config {
            storeFile file('...jks')
            storePassword '...'
            keyAlias '...'
            keyPassword '.'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        debug {
            debuggable true
            useProguard false
        }
        release {
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            zipAlignEnabled true
            signingConfig signingConfigs.config
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':linkedin-sdk')

    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'

    compile 'org.slf4j:slf4j-api:1.7.21'
    compile 'org.androidannotations:androidannotations-api:4.0.0'
    apt "org.androidannotations:androidannotations:4.0.0"
    compile 'org.apache.commons:commons-io:1.3.2'
    compile 'commons-validator:commons-validator:1.5.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'net.danlew:android.joda:2.9.2'
    compile 'com.wang.avi:library:1.0.5'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'io.underdark:underdark:1.0.10'
    compile 'com.facebook.stetho:stetho:1.4.1'
    compile 'com.uphyca:stetho_realm:2.0.0'
    compile 'io.realm:android-adapters:1.3.0'
    compile 'me.leolin:ShortcutBadger:1.1.6@aar'
    compile 'com.github.halysongoncalves:pugnotification:1.8.1'

    compile 'com.facebook.android:facebook-android-sdk:4.11.0'
    compile('com.twitter.sdk.android:twitter:1.14.1@aar') {
        transitive = true;
    }
    compile 'com.google.android.gms:play-services-auth:9.2.1'
}

configurations {
    all*.exclude group: 'commons-logging', module: 'commons-logging'
}

apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
        resourcePackageName '...'
    }
}

apply plugin: 'com.google.gms.google-services'

Regards,

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:20 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
ghostcommented, Jan 31, 2017

@zaki50 Thank you for the fastest reaction time I’ve ever encounter after reporting a bug 👍 I just verified on our main project and can confirm that 2.4.0-SNAPSHOT is now working.

1reaction
zaki50commented, Jan 31, 2017

@lucavitucci Thanks. Your sample project helps me a lot! Snapshot build will be deployed shortly.

Could you try it when you have a time? https://github.com/realm/realm-java/blob/master/README.md#using-snapshots (I already confirmed that your sample project worked as expected with my local build of Realm though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview (SLF4J 2.0.1 API)
SLF4J 2.0.1 API ; org.slf4j.cal10n. SLF4J API extensions ; org.slf4j.ext. Localized logging using the CAL10N API. ; org.slf4j.instrumentation. Java instrumentation ...
Read more >
Realm doesn't work with SLF4J? - Stack Overflow
It wants to include some unknown logger to our code. Main problem with our app is, that we have some 3rd party library,...
Read more >
realm-gradle-plugin:1.0.1 breaks Proguard #3018 - GitHub
Building the release build fails due to proguard issues when using realm 1.0.1 but succeeds when building with realm 1.0.0. Warning: org.slf4j.
Read more >
351121 – NoSuchMethodError on slf4j - Bugs - Eclipse
Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) at org.eclipse.ui.PlatformUI.
Read more >
Solved: REST API example on Authentication Manager 8.4 not ...
[ERROR] urls[1] = file:/C:/Users/s/.m2/repository/org/slf4j/slf4j- ... .m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
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