Search code examples
androidandroid-buildandroid-r8

Missing class org.slf4j.impl.StaticLoggerBinder (referenced from: void org.slf4j.LoggerFactory.bind() and 3 other contexts) when using Pusher library


with R8 enabled (isMinifyEnabled = true) and using "com.pusher.pusher-java-client:2.4.4" library I get the following error for release build:

AGPBI: {"kind":"error","text":"Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in project\app\build\outputs\mapping\devRelease\missing_rules.txt.","sources":[{}]} AGPBI: {"kind":"error","text":"Missing class org.slf4j.impl.StaticLoggerBinder (referenced from: void org.slf4j.LoggerFactory.bind() and 3 other contexts)","sources":[{}],"tool":"R8"} Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in project\app\build\outputs\mapping\devRelease\missing_rules.txt.

Missing class org.slf4j.impl.StaticLoggerBinder (referenced from: void org.slf4j.LoggerFactory.bind() and 3 other contexts)

How can I solve it? With isMinifyEnabled = false it builds without issues


Solution

  • Fixed by adding the following rule:

    ##---------------Begin: proguard configuration for Pusher Java Client  ----------
    -dontwarn org.slf4j.impl.StaticLoggerBinder
    ##---------------End: proguard configuration for Pusher Java Client  ----------