Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoClassDefFoundError: Problems with linking my own jar to Android project

Tags:

java

android

jar

So, I'm trying to develop a client-server application for Android. For this purposes I've created an engine, that I'm going to use both in server and in Android applecation and export it as a .jar file.

There was no issues in using this engine.jar on server side (simple background java application), but I faced some problems with linking mention .jar file to my android project.

To link engin.jar I follow some steps:

  • created "libs" dir in my android project
  • imported engine.jar in this folder

After this engine.jar could be seen in Android Dependences group. Also I can use all classes from that .jar, Eclipse doesn't mark them as error. My project compiles fine, but the app crashes when I'm trying to create any object from engine.jar with the following error:

04-15 23:18:12.885: E/AndroidRuntime(17409): java.lang.NoClassDefFoundError: Common.Message.Message

I guess I've tried everything. Could anyone share his ideas about the root cause of described situation?

like image 653
Max Myasoed Avatar asked Oct 08 '22 02:10

Max Myasoed


1 Answers

I too experienced the same problem. I resolved it by doing the following:

Right click on the project directory -> Build Path -> Configure Build Path -> Select Tab Order and Export -> Check/Select the checkboxes of the concerned .jar files -> Press Ok.

Hope this resolves your problem as well.

like image 87
Arun George Avatar answered Oct 12 '22 21:10

Arun George