Reputation: 155
I'm a new to developing for android.I use the db4o database in my first project. But I get an error with the following code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//only want to get the configuration
EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration();//This one will popup
}
the error log :
06-14 20:15:30.249: W/dalvikvm(445): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
06-14 20:15:30.249: E/AndroidRuntime(445): Uncaught handler: thread main exiting due to uncaught exception
06-14 20:15:30.289: E/AndroidRuntime(445): java.lang.NoClassDefFoundError: com.db4o.Db4oEmbedded
06-14 20:15:30.289: E/AndroidRuntime(445): at com.hlh.AtestActivity.onCreate(AtestActivity.java:34)
06-14 20:15:30.289: E/AndroidRuntime(445): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-14 20:15:30.289: E/AndroidRuntime(445): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
I feel very confused why does it work when I use it in a java project but it does not work in an android project Are there some restrictions in Android for this?
Upvotes: 0
Views: 569
Reputation: 16393
It sounds lilke you don't have the library .jar in the correct place.
For android it needs to be in a subfolder of your project called libs
which should be on the same level as assets
and res
and the like (this was a recent change if you don't remember having to do this previously).
Simply create that folder and drop your jar in there and Eclipse will take care of the rest.
Upvotes: 1