问题
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)
回答1:
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.
回答2:
Did you go through the information at this link? http://tools.android.com/recent/dealingwithdependenciesinandroidprojects
来源:https://stackoverflow.com/questions/10059152/java-lang-noclassdeffounderror-adt-17-known-issue