java.lang.NoClassDefFoundError on Android sdk and

2020-04-18 08:21发布

问题:

Good morning ppl. I have what it looks like to be a commong problem in android, import jars from libraries. I'm trying to use a library to consume an in house api. I copied the jar into the libs folder on my android project and went to Properties -> Java Build Path -> Libraries and added the jar. Also, I checked the boxes within the jar name in the Order and Export tab. all I have is the

java.lang.NoClassDefFoundError exception.

I have read almost every post that points to the same answer. Put the jar on libs folder and make the steps listed above. Nothing worked. I'm running the ADT v 20, on the Indigo release on a Win 7 x64. I'm not very skilled on java or java architectures but this is driving me nuts. Anyone has a differente approach to this? I'm missing something?

Thanks in advance

回答1:

You need to simply drag the jar file into the libs folder and not manually add it. Try deleting the jar file from

Properties -> Java Build Path -> Libraries

clean and rebuild the project.

Explanation: The process of loading library has been automated and changed from ADT 16 onwards and it is not backward compatible with the older method. You were actually trying to use both the methods of adding library which was adding the library twice and breaking it.



回答2:

Go on the tab "Order and Export", inside "Properties->Java Build Path" and check the unchecked boxes. It worked here...



标签: android jar adt