问题
I've used KSOP2 in my project and it worked all these days. Recently I bought a new machine and moved my project to new machine and imported the ksoap library to project etc etc and when I try to run the application I get following error in the emulator
Caused by: java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
this is the place where exception is thrown.
SoapObject request = new SoapObject(namesapce, methodname);
has is something to do with 64 bit machines??
How come the app that worked all these days stopped working all of a sudden?? Can someone enlighten me please. I'm stuck with this. Thanks for your time in advance.
回答1:
I had similar problem, simply I forgot to check checkbox on kosoap2 library in Java Build Path options, Order And Export tab :)
回答2:
I managed to solve the problem by
- Creating a folder "libs" in the project
- Copying the external jars in to the folder
- Refresh the folder
- Go to properties -> Build path -> Add Jar (not external JAR)
- Clean the project
- Restart Eclipse
Boom it worked for me. Hope it'll help others too.
回答3:
This may be related to the latest Android plugin and tools (r17). I read somewhere that external jar files need to be run through the dx --dex
tool (because of the different binary format of Java binaries in Android), but it didn't work for me. What I ended up doing was adding the project as source instead of compiled binaries (by linking to the source from the project and adding it as a source folder.) This way Eclipse builds it properly and Android finds it during runtime.
来源:https://stackoverflow.com/questions/9866808/ksop2-librarary-class-not-found-exception