我有一个Android活动
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();
}
}
在设备中运行之前一切正常。
运行后,Activity崩溃了,我收到了这个错误:
java.lang.NoClassDefFoundError: com.test.test.SetupActivity $ BonjourBrowserSingleServiceListener