Android and slf4j: "java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory"

Two days ago, when my Android project in eclipse was still working, I added the “Android SDK 4.0.3” to my SDK (in addition to the Android SDK 2.1).

From now on, I have problems with the slf4j-android library ; here is the exception:

Uncaught handler: thread main exiting due to uncaught exception
  java.lang.ExceptionInInitializerError
  at java.lang.Class.newInstanceImpl(Native Method)
  at java.lang.Class.newInstance(Class.java:1479)
  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4363)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
  at it.cefriel.swa.urbanopoly.client.game.UrbanopolyActivity.<clinit>(UrbanopolyActivity.java:11)

I am using JAR slf4j-android-1.5.8.jar . The build string seems to be configured correctly. I also tried creating another project using slf4j and I got the same error.

Any ideas?

Thanks in advance

+3
source share
1 answer

Try adding slf4j-api-1.5.8.jar or the latest version, as well as the current version of slf4j-android-1.5.8.jar

0

All Articles