0

I'm using wsimport.exe from the android sdk, and importing manually (dragging in the output classes) into my project (no external jars - the imported files are part of the src folder).

It works great on a java test project, but when I'm trying to implement it on an android project I'm facing this weird problem. I already read some information about a known problem with ADT 17 changes but it all related to external jars reordering. I'm not importing any jar so it's not relevant to me.

Does anyone know if it's part of the ADT 17 problem?

Here is my logcat:

04-06 02:07:09.340: E/AndroidRuntime(13308): java.lang.NoClassDefFoundError: org.tempuri.Service1
04-06 02:07:09.340: E/AndroidRuntime(13308):    at hhs.pack.ListViewActivity.getListFromDB(ListViewActivity.java:72)
04-06 02:07:09.340: E/AndroidRuntime(13308):    at hhs.pack.ListViewActivity.onCreate(ListViewActivity.java:40)
Lukas Knuth
  • 25,449
  • 15
  • 83
  • 111
Shahar
  • 541
  • 2
  • 7
  • 22
  • You might want to take a look at http://stackoverflow.com/questions/8581627/android-activity-under-eclipse-adt-with-project-dependencies-failed-resolving-x – jfritz42 Apr 12 '12 at 17:46

1 Answers1

0

The problem could be that the apk tool ignores the classes or that Eclipse does not know hat to do with the class files (I'll explain this in a bit). Why don't you just create a jar with your classes? In eclipse you can just right click on the project which has the classes and say Export > Java > Jar.

If that is out of the question, try moving the classes you generate to the bin > classes folder instead of keeping it in your source (unless you have setup eclipse to keep classes in the same folders as the source which is not the default option. Using this option may fix your problem).

You could try turning on the Allow output folders for source folders option in eclipse under Project > Properties > Java Build Path > Source.

If you go with generating a jar otpion, then the jar you are using in your source should be in the libs folder in your Android project otherwise it will not get packaged with your application. I've noticed that in some versions of the older versions of ADT you have to also add the jar to your project libraries.

That is all I can suggest, I just always create my own jar in situations like yours.

Ali
  • 12,354
  • 9
  • 54
  • 83
  • Sorry for the newbie question, I don't usually works with jars. How can I move the jar from the "Referenced libraries" to my folder "libs"? – Shahar Apr 08 '12 at 01:06
  • In eclipse, just copy it from the referenced libraries and paste it in the libs folder. Otherwise right click on the jar and go to properties.. you should be able to see it's path in there and then you can copy paste it manually. – Ali Apr 08 '12 at 06:27
  • Thank you. It seems like I'm doing something wrong. I created a new (regular) folder and named it "libs". When I'm trying to drag/copy paste the jar, it says "Cannot paste the clipboard contents into the selected elements". What am I doing wrong? – Shahar Apr 08 '12 at 16:23
  • Not sure, don't drag and drop, copy and paste. If it's not working them look up the path of the jar by right clicking on it and going to properties. Then just locate the file on the file system and copy it manually. – Ali Apr 09 '12 at 01:24
  • OK I managed to do so. But still the same exception is thrown. – Shahar Apr 09 '12 at 12:14
  • I'm out of ideas. Can't really help more unless I can see your environment. – Ali Apr 09 '12 at 13:26