2

Everything of a Maven projected imported to Eclipse appears to be fine. This Maven project has been added to an Android app's build path. The app can be built without any problem. However, whenever a class of the Maven project is instantiated, java.lang.NoClassDefFoundError occurs. For testing, here is a simple class:

package com.my.maven;
public class Foo {

    public String sFoo;
    public Foo ()
    {
        sFoo = "Foo";
    }
}

Whenever the app reaches the following statement:

Foo foo = new Foo();

The following error occurs:

java.lang.NoClassDefFoundError: com.my.maven.Foo

There are a lot of posts about NoClassDefFoundError, and I have spent a lot of time reading and trying the solutions, but none has worked.

Any tip will be greatly appreciated.

11
  • Try: Project -> Properties -> Maven -> uncheck "Resolve dependencies from Workspace projects" Commented Mar 13, 2013 at 14:34
  • @Milos, I tried that before. I tried it again a moment ago, and it still did not make any difference. I always clean the project after making any changes to ensure the changes take effect. Commented Mar 13, 2013 at 14:51
  • @Ahmad, the Maven project is added to the build configuration as a project, not a jar file. Exporting the Maven project as a jar file will be my next step, an undesirable one, if I can not make the current configuration work. Commented Mar 13, 2013 at 14:55
  • @Hong, could you please show a printscreen of your project, to see how did you inserted the maven one into the android app. Commented Mar 13, 2013 at 14:58
  • 1
    Not Maven Dependencies nor JRE System Library, in Order and Export tab, tick the dependency project, i.e. the one you have added in Projects tab. Commented Mar 14, 2013 at 9:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.