Android的异常:“java.lang.NoClassDefFoundError的:javax.jmdns.JmDNS” [英] Android Exception: 'java.lang.NoClassDefFoundError: javax.jmdns.JmDNS'

查看:460
本文介绍了Android的异常:“java.lang.NoClassDefFoundError的:javax.jmdns.JmDNS”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望我的问题不是太傻,但我有以下问题...

Hopefully my issue isn't too silly but I'm having the following problem...

我导入一个罐子,其中包含了库 JmDNS 到我的项目。我的项目设置来处理这样的JmDNS ...

I'm importing a jar which contains the library JmDNS into my project. My project sets up to handle JmDNS like this...

      setUp();
        try {
            peer = new PublicPeer("Aidan",6666,6667,this);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

     private void setUp(){
        android.net.wifi.WifiManager wifi =
               (android.net.wifi.WifiManager)
                  getSystemService(android.content.Context.WIFI_SERVICE);
        lock = wifi.createMulticastLock("Lock");
            lock.setReferenceCounted(true);
            lock.acquire();
       }

其中,锁= android.net.wifi.WifiManager.MulticastLock锁; PublicPeer等;

当执行到同行=新PublicPeer(艾丹,6666,6667,这一点); 以下错误输出...

When execution reaches peer = new PublicPeer("Aidan",6666,6667,this); the following error outputs...

 11-13 13:12:47.644: W/dalvikvm(204): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
 11-13 13:12:47.644: E/AndroidRuntime(204): Uncaught handler: thread main exiting due to uncaught exception
 11-13 13:12:47.664: E/AndroidRuntime(204): java.lang.NoClassDefFoundError: javax.jmdns.JmDNS
 11-13 13:12:47.664: E/AndroidRuntime(204):     at com.daniel.business.publicchat.PeerAdvertiser.<init>(PeerAdvertiser.java:36)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at com.daniel.business.publicchat.PublicPeer.<init>(PublicPeer.java:60)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at com.chatr.org.PublicChat.onCreate(PublicChat.java:21)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at android.os.Handler.dispatchMessage(Handler.java:99)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at android.os.Looper.loop(Looper.java:123)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at android.app.ActivityThread.main(ActivityThread.java:4363)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at java.lang.reflect.Method.invokeNative(Native Method)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at java.lang.reflect.Method.invoke(Method.java:521)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
 11-13 13:12:47.664: E/AndroidRuntime(204):     at dalvik.system.NativeStart.main(Native Method)

如果我的上述理解是正确的它具有位于我JmDNS库不过的问题,它被添加。我100%肯定。而我导入JAR的code可以在这里找到: https://github.com/ Ps2Fino / DSProject-后端

If my understanding of the above is correct it's having problems located my JmDNS library however, it is being added. I'm 100% sure of it. The code of the JAR which I am importing can be found here: https://github.com/Ps2Fino/DSProject-Backend

修改

这似乎是一个问题被添加到Android JmDNS作为记录在这里:的http:// home.heeere.com/tech-androidjmdns.html 我已经尝试下面的重新JARING的JmDNS JAR文件指导,但我仍然有同样的问题。它似乎没有运作良好与它

It appears to be an issue with JmDNS being added to Android as documented here: http://home.heeere.com/tech-androidjmdns.html I've attempted following that guide for "re-jaring" the JmDNS JAR file but I'm still having the same issue. It doesn't appear to be working well with it.

推荐答案

我觉得JmDNS开发商可能有关于发布/维持其释放,什么更糟糕的是穷人记录了一些问题,可以从两个的 SourceForge上的主页和的 Maven的中央回购的,但是,你可以看到,对于同一个版本的jar文件(最新版本是3.4.1)是不同的,从Maven的中央存储库一个更干净,大概这就是Heeere谈了他的网页约rejaring。我总是用Maven构建我的Andr​​oid应用程序,因此从来没有试图从SourceForge的之一,然而,从Maven的下载jar文件为我工作。

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.

这篇关于Android的异常:“java.lang.NoClassDefFoundError的:javax.jmdns.JmDNS”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆