2

I have a android Activity:

public class SetupActivity extends Activity {
    public class BonjourBrowserSingleServiceListener implements
            ResolveListener,
            BrowseListener {

        @Override
        public void serviceResolved(DNSSDService resolver, int flags,
                                    int ifIndex, String fullName, String hostName,
                                    int port, TXTRecord txtRecord) {
            System.out.println("RESOLVE flags:" + flags + ", ifIndex:"
                    + ifIndex + ", Name:" + fullName + ", Hostname:" + hostName
                    + ", port:" + port + ", TextRecord:" + txtRecord);
        }

        @Override
        public void operationFailed(DNSSDService arg0, int arg1) {
            // TODO Auto-generated method stub
        }

        @Override
        public void serviceFound(DNSSDService browser, int flags, int ifIndex,
                             String serviceName, String regType, String domain) {

            System.out.println("ADD flags:" + flags + ", ifIndex:" + ifIndex
                    + ", Name:" + serviceName + ", Type:" + regType
                    + ", Domain:" + domain);

            try {
                String fullName = DNSSD.constructFullName(serviceName, regType,
                        domain);
                System.out.println(" fullName " + fullName);
                DNSSDService r = DNSSD.resolve(0, DNSSD.ALL_INTERFACES,
                        serviceName, regType, domain, this);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        @Override
        public void serviceLost(DNSSDService arg0, int arg1, int arg2,
                                String arg3, String arg4, String arg5) {
            // TODO Auto-generated method stub
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setup);
        BonjourBrowserSingleServiceListener _single_service_listener =
                new BonjourBrowserSingleServiceListener();
    }
}

everything ok before running in device.

after running, the Activity is crash and I got this error:

java.lang.NoClassDefFoundError: com.test.test.SetupActivity$BonjourBrowserSingleServiceListener

chanjianyi
  • 607
  • 4
  • 15
  • 35

0 Answers0