MuntashirAkon/AppManager · error · IOException
Could not start ADB service discovery
Error message
Could not start ADB service discovery
What it means
Guard in getLatestAdbDaemon(): the AdbMdns discovery instance failed to start (adbMdnsTcp.start() or, on P+, adbMdnsTls.start() failed), so mDNS service discovery cannot run at all. On Android this is usually caused by NSD/mDNS being unavailable on the current network or a missing multicast lock, not by the ADB daemon itself.
Solutions
- Acquire a MulticastLock before starting mDNS discovery
- Retry discovery after the network finishes connecting (Wi-Fi fully up)
- Check that NSD/mDNS is supported and enabled on the device/network
- Fall back to manual host/port input when discovery is unavailable
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at app/src/main/java/io/github/muntashirakon/AppManager/adb/AdbUtils.java:91 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/a5e972f3988eea16.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/adb/AdbUtils.java:91
});
AdbMdns adbMdnsTls = null;
try {
adbMdnsTcp.start();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
adbMdnsTls = new AdbMdns(context, AdbMdns.SERVICE_TYPE_TLS_CONNECT, (hostAddress, port) -> {
if (hostAddress != null) {
atomicHostAddress.set(hostAddress.getHostAddress());
atomicPort.set(port);
}
resolveHostAndPort.countDown();
});
adbMdnsTls.start();
}
if (!resolveHostAndPort.await(timeout, unit)) {
throw new InterruptedException("Timed out while trying to find a valid host address and port");
}
} catch (RuntimeException e) {
throw new IOException("Could not start ADB service discovery", e);
} finally {
stopDiscovery(adbMdnsTcp);
stopDiscovery(adbMdnsTls);
}
String host = atomicHostAddress.get();
int port = atomicPort.get();
if (host == null || port == -1) {
throw new IOException("Could not find any valid host address or port");
}
return new Pair<>(host, port);
}
private static void stopDiscovery(AdbMdns adbMdns) {
if (adbMdns == null) {
return;
}
try {View on GitHub (pinned to 0152f468fc)