3

I am currently working on an android application that needs to use some shared classes which are also used on some serverside. So on the one hand I have this standard java project inside eclipse where I have some POJOs, infercaes and so on. And on the other hand I have an android application project with an activity that should use those POJOs.

My first try to get the android project to know the java project was simply adding it as a "required project" in the build-path properties inside eclipse. That resulted into:

java.lang.NoClassDefFoundError: my.package.Pojo

I googled it and tried a lot, but still the question stands:

How do I set everything up properly, so that my ADT v21.1 android project will still know my java project, even at runtime?

Some things I already tried that did not seem to change anything:

  • after adding the "required project" I also set the dependency to be exported under eclipse "Order and Export" dialog

  • I tried building the java project as a jar-file and adding it as a jar-dependency to the android project

  • I created a android library project as 'glue': I added the java project as a dependency to the library project and the library project as a 'android dependency' to the android project

  • I checked that all projects where inside the filesystem in the same parent folder (read, that the underlying ant task might have some troubles otherwise)

  • I googled for a loooong time

Would really be nice if someone could help. Maybe I'm just missing some tiny little thind?

Bluddy

Bluddymarri
  • 313
  • 1
  • 3
  • 12
  • 2
    make sure you add your required classes or project into your android project's classpath – Abubakkar Feb 19 '13 at 17:39
  • 2
    Hate to answer myself, but that's what's happening if you don't stop the research after asking the question. I may quote the user 'Phix' and say it out load: OH. MY. GOODNESS. The Problem is that I build the java project using Java 7 which seems to by not supported by android. 'Phix' pointed that out in his very helpful posting (he was also andwering himself): http://stackoverflow.com/a/13304441/1145459 Thx anyway, Bluddy PS: saddly I haven't got enough reputation to anser my own question – Bluddymarri Feb 19 '13 at 18:35

1 Answers1

4

The Problem is that I build the java project using Java 7 which seems to by not supported by android. 'Phix' pointed that out in his very helpful posting (he was also andwering himself): https://stackoverflow.com/a/13304441/1145459

(answer by Bluddymarri, I just posted it here to help him get it closed)

Community
  • 1
  • 1
DigCamara
  • 5,540
  • 4
  • 36
  • 47