{"record":{"id":"06dc0a1d39eaccea","repo":"MuntashirAkon/AppManager","slug":"could-not-find-any-valid-host-address-or-port","errorCode":null,"errorMessage":"Could not find any valid host address or port","messagePattern":"Could not find any valid host address or port","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/adb/AdbUtils.java","lineNumber":100,"sourceCode":"                    }\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 {\n            adbMdns.stop();\n        } catch (RuntimeException ignored) {\n        }\n    }\n\n    @RequiresApi(Build.VERSION_CODES.R)\n    public static boolean enableWirelessDebugging(@NonNull Context context) {\n        ContentResolver resolver = context.getContentResolver();\n        boolean wirelessDebuggingEnabled = Settings.Global.getInt(resolver, SettingsHidden.Global.ADB_WIFI_ENABLED, 0) != 0;","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/adb/AdbUtils.java#L82-L118","documentation":"In getLatestAdbDaemon, mDNS-based ADB/TLS-Connect service discovery ran for the full timeout but no discoverable device advertised a usable host address and port, so atomicHostAddress/atomicPort were never populated before the countdown latch released. It fires when no wireless-debugging device is reachable on the network, discovery is blocked (multicast disabled, VPN, firewall), or pairing/discovery isn't enabled on the device.","triggerScenarios":"Thrown at app/src/main/java/io/github/muntashirakon/AppManager/adb/AdbUtils.java:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enable wireless debugging on the device and keep it on the same network/adbmdns scope","Check that mDNS/multicast traffic is allowed (no VPN, firewall, or AP isolation blocking 5353/udp)","Retry discovery with a longer timeout to allow slow mDNS resolution to complete","Fall back to a known host:port from adb pair/connect or manual entry instead of discovery"],"exampleFix":null,"handlingStrategy":"retry","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-14T11:17:12.474Z"}