简体   繁体   中英

Add external jar jwordpress-0.5.1.jar to android project in eclipse

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.

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

ie 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM