Android Exception: 'java.lang.NoClassDefFoundError: javax.jmdns.JmDNS'

后端 未结 3 862
礼貌的吻别
礼貌的吻别 2020-12-21 07:22

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 p

相关标签:
3条回答
  • 2020-12-21 07:23

    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.

    0 讨论(0)
  • 2020-12-21 07:36

    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

    0 讨论(0)
  • 2020-12-21 07:44

    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.

    0 讨论(0)
提交回复
热议问题