1

I add an external jar jwordpress-0.5.1.jar. In logcat I see:

  • 12-30 09:34:41.041: E/dalvikvm(379): Could not find class 'net.bican.wordpress.Wordpress', referenced from method ru.androiden.client.MainActivity.onCreate
  • 12-30 09:34:41.201: E/AndroidRuntime(379): FATAL EXCEPTION: main
  • 12-30 09:34:41.201: E/AndroidRuntime(379): java.lang.NoClassDefFoundError: net.bican.wordpress.Wordpress

I have used several methods to add jar, for example:

What do I do? I have already solved this problem for two days. Regards, Denis.

Community
  • 1
  • 1
Denis
  • 3,595
  • 12
  • 52
  • 86

1 Answers1

1

It sounds like the jar file is not being packaged with your application.

i.e. it's on your eclipse classpath (assuming eclipse's java editor didn't complain about your import statement?) so it's there at compile time. BUT the jar file isn't actually being bundled with your app, so the class that you're referencing isn't actually available at runtime.

To fix this, just create a libs directory in your project and follow the steps that you read to import the jar file from there. This should ensure that the jar gets bundled and its classes are available at runtime.

phippsnatch
  • 186
  • 7
  • sorry, but I have a folder **libs** in my project. Do You say about this folder? – Denis Dec 30 '12 at 13:25
  • Ok, I'm not 100% sure what you've actually done... maybe have a squiz at: http://stackoverflow.com/questions/2316445/how-to-use-and-package-a-jar-file-with-my-android-app – phippsnatch Dec 30 '12 at 13:51
  • 1
    Thank you. The problem was that the jwordpress-0.5.1.jar built in Java 1.7, but the project built in Java 1.5. – Denis Dec 31 '12 at 07:02