{"record":{"id":"a5e972f3988eea16","repo":"MuntashirAkon/AppManager","slug":"could-not-start-adb-service-discovery","errorCode":null,"errorMessage":"Could not start ADB service discovery","messagePattern":"Could not start ADB service discovery","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/adb/AdbUtils.java","lineNumber":91,"sourceCode":"        });\n        AdbMdns adbMdnsTls = null;\n        try {\n            adbMdnsTcp.start();\n            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {\n                adbMdnsTls = new AdbMdns(context, AdbMdns.SERVICE_TYPE_TLS_CONNECT, (hostAddress, port) -> {\n                    if (hostAddress != null) {\n                        atomicHostAddress.set(hostAddress.getHostAddress());\n                        atomicPort.set(port);\n                    }\n                    resolveHostAndPort.countDown();\n                });\n                adbMdnsTls.start();\n            }\n            if (!resolveHostAndPort.await(timeout, unit)) {\n                throw new InterruptedException(\"Timed out while trying to find a valid host address and port\");\n            }\n        } catch (RuntimeException e) {\n            throw new IOException(\"Could not start ADB service discovery\", e);\n        } finally {\n            stopDiscovery(adbMdnsTcp);\n            stopDiscovery(adbMdnsTls);\n        }\n\n        String host = atomicHostAddress.get();\n        int port = atomicPort.get();\n        if (host == null || port == -1) {\n            throw new IOException(\"Could not find any valid host address or port\");\n        }\n        return new Pair<>(host, port);\n    }\n\n    private static void stopDiscovery(AdbMdns adbMdns) {\n        if (adbMdns == null) {\n            return;\n        }\n        try {","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/adb/AdbUtils.java#L73-L109","documentation":"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.","triggerScenarios":"Thrown at app/src/main/java/io/github/muntashirakon/AppManager/adb/AdbUtils.java:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}