{"id":2978,"date":"2014-03-13T00:01:10","date_gmt":"2014-03-13T00:01:10","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/13\/problem-about-jmdns-collection-of-common-programming-errors\/"},"modified":"2014-03-13T00:01:10","modified_gmt":"2014-03-13T00:01:10","slug":"problem-about-jmdns-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/13\/problem-about-jmdns-collection-of-common-programming-errors\/","title":{"rendered":"problem about jmdns-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ebcf6ffdb52f7bc6cf56c7554fd35f37?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nHyunwoo Nam<br \/>\nandroid eclipse jmdns<br \/>\nMy code worked but it does not work suddenly. The code is as follows.public class AndroidDnssdDiscoveryTestActivity extends Activity { \/** Called when the activity is first created. *\/android.net.wifi.WifiManager.MulticastLock lock; android.os.Handler handler = new android.os.Handler(); final Context context = this; AlertDialog alert=null;public void onCreate(Bundle savedInstanceState) {\/** StrictMode.ThreadPolicy was introduced since API Level 9 and the default thread policy had been changed si<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b66c479cd8053b791b5266f29407c817?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser268397<br \/>\nandroid jmdns<br \/>\nI&#8217;m trying to list some JmDNS services that I discover in my Android app and whenever I call this method my app crashes in the emulator? I tried commenting out blocks of code and code inside methods and it still crashes on the emulator. Anybody have any ideas? import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/cac178ad32ea3fba1f594303b778010e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nyorkw<br \/>\njava android jar classpath jmdns<br \/>\nHopefully my issue isn&#8217;t too silly but I&#8217;m having the following problem&#8230;I&#8217;m importing a jar which contains the library JmDNS into my project. My project sets up to handle JmDNS like this&#8230;setUp();try {peer = new PublicPeer(&#8220;Aidan&#8221;,6666,6667,this);} catch (IOException e) {\/\/ TODO Auto-generated catch blocke.printStackTrace();}private void setUp(){android.net.wifi.WifiManager wifi =(android.net.wifi.WifiManager)getSystemService(android.content.Context.WIFI_SERVICE);lock = wifi.createMulticastLo<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/59e365b07967fb19f5da67cb62a24f81?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nmizo<br \/>\nandroid jmdns<br \/>\nFor some reason it doesn&#8217;t like the getInetAddresses() method in the lines:Enumeration additions = (Enumeration) ev.getInfo().getInetAddresses(); if (ev.getInfo().getInetAddresses() != null &amp;&amp; ev.getInfo().getInetAddresses().length &gt; 0) {additions = ev.getInfo().getInetAddresses()[0].getHostAddress(); }import java.io.IOException; import java.net.InetAddress; import java.net.NetworkInterface; import java.util.Enumeration;import javax.jmdns.JmDNS; import javax.jmdns.ServiceEvent; impor<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a80763a819054a644d6ada112f37a4ad?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSeva Alekseyev<br \/>\nandroid dependency-management jmdns<br \/>\nI&#8217;ve added jmDNS 3.4.1 to my Android project. Copied the JAR under lib, then under &#8220;Java BuildPath&#8221;\/Libraries added a reference.Now my build fails with the following message in Console:[2012-07-27 22:59:07 &#8211; Yarxi] Dx UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Lcom\/strangeberry\/jmdns\/tools\/Browser$1; at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)at com.android.dx.dex.file.DexFile.add(DexFile.java:163)at com.android.dx.command.d<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hyunwoo Nam android eclipse jmdns My code worked but it does not work suddenly. The code is as follows.public class AndroidDnssdDiscoveryTestActivity extends Activity { \/** Called when the activity is first created. *\/android.net.wifi.WifiManager.MulticastLock lock; android.os.Handler handler = new android.os.Handler(); final Context context = this; AlertDialog alert=null;public void onCreate(Bundle savedInstanceState) {\/** StrictMode.ThreadPolicy was introduced since API [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2978","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2978","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2978"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2978\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}