Skip to content Skip to sidebar Skip to footer

Android Exception: 'java.lang.noclassdeffounderror: Javax.jmdns.jmdns'

Hopefully my issue isn't too silly but I'm having the following problem... I'm importing a jar which contains the library JmDNS into my project. My project sets up to handle JmDNS

Solution 1:

I think JmDNS developers may have some issues regarding to publish/maintain their release and what even worse is poor documented, you can download jar from both SourceForge home page and Maven central repo, however, you can see that the jar file for the same release (latest version is 3.4.1) are different, the one from Maven central repository is more clean, probably this is what Heeere talked in his page about rejaring. I always use Maven build my Android application and so never tried the one from SourceForge, however, jar file downloaded from Maven works for me.

Solution 2:

This might be happening as the class is not loaded yet. Class clazz = getClassLoader().loadClass("javax.jmdns.JmDNS"); Then use reflection to create instance of object of type clazz

Solution 3:

One way that you could go around adding the jar file would be to take the source code from the JmDNS.jar file and add it directly to your project. I was having a issue similar to yours where I could not get my Android application to properly work with the JmDNS.jar file from SourceForge or Maven. I just took all of the source files from jar file, added them to my Eclipse project, built it, and it works like a charm.

I don't know if this would be a long term solution that you would want to use, but this solution worked for me.

Post a Comment for "Android Exception: 'java.lang.noclassdeffounderror: Javax.jmdns.jmdns'"