MuntashirAkon/AppManager · error · IOException

Could not find any valid host address or port

Error message

Could not find any valid host address or port

What it means

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.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/adb/AdbUtils.java:100

                    }
                    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 {
            adbMdns.stop();
        } catch (RuntimeException ignored) {
        }
    }

    @RequiresApi(Build.VERSION_CODES.R)
    public static boolean enableWirelessDebugging(@NonNull Context context) {
        ContentResolver resolver = context.getContentResolver();
        boolean wirelessDebuggingEnabled = Settings.Global.getInt(resolver, SettingsHidden.Global.ADB_WIFI_ENABLED, 0) != 0;

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Enable wireless debugging on the device and keep it on the same network/adbmdns scope
  2. Check that mDNS/multicast traffic is allowed (no VPN, firewall, or AP isolation blocking 5353/udp)
  3. Retry discovery with a longer timeout to allow slow mDNS resolution to complete
  4. Fall back to a known host:port from adb pair/connect or manual entry instead of discovery
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at app/src/main/java/io/github/muntashirakon/AppManager/adb/AdbUtils.java:100 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/06dc0a1d39eaccea. Report an issue: GitHub.