Repository navigation
Troubleshooting and FAQ
Start with the checklist, then find your symptom below.
- Device and service are on the same network and subnet (no guest Wi-Fi, no client isolation, VPN off).
-
iOS: the type is in
NSBonjourServicesand Local Network access is granted (checkLocalNetworkAccess()). - Android: on the emulator, only services published inside it are found. Test real devices from a real device.
- You registered an
errorlistener (native errors are dropped without one). -
Android: try
implType: 'DNSSD'. - The app was rebuilt after installing or upgrading the library (
pod installon iOS).
react-native-zeroconf: native module not found. Make sure the library is linked and the app rebuilt. Expo Go is not supported, use a development build instead.
Older versions crashed with an error about null (for example reading a property of the native module). Both mean the native code is not in the binary:
-
Expo Go cannot load third-party native modules. Use a development build:
npx expo run:ios,npx expo run:androidor EAS Build. -
Bare app: run
cd ios && pod installand rebuild the app. A Metro reload is not enough.
Message: "not authorized, add the service type to NSBonjourServices in Info.plist". The type you scan or publish is not declared.
Add _<type>._<protocol> (for example _http._tcp) to NSBonjourServices (in Expo: expo.ios.infoPlist) and rebuild. When running several scans, every scanned type must be listed. See Permissions and Setup.
Message: "Local Network access denied". The user declined the Local Network prompt.
Call checkLocalNetworkAccess(). If it returns 'denied', ask the user to enable Settings > Privacy & Security > Local Network for your app. See Permissions and Setup.
This is the 0.15 equivalent of -65555: the service type is missing from NSBonjourServices. 0.16 reports it as domain: 'DNSSD', code: -65555 (see Migrating to 0.16).
The device answers slowly. Increase resolveTimeout:
zeroconf.scan({ type: 'ipp', resolveTimeout: 15 })The emulator's network doesn't reach other devices' multicast, so it only finds services published inside the emulator. Publish a test service from the app to check your code, use a real device for real devices, or see the advanced setup in Android Emulator.
The app targets API 37, or declares ACCESS_LOCAL_NETWORK in its manifest, and the user hasn't granted it. Request it with checkLocalNetworkAccess() before scanning or publishing. See Permissions and Setup.
NsdManager is known to stop silently, fail resolves, or be throttled by OEM battery optimizations. Try, in order:
-
implType: 'DNSSD'. - Stop scans in the background and restart them when the app is active:
import { AppState } from 'react-native'
const subscription = AppState.addEventListener('change', state => {
if (state === 'active') zeroconf.scan({ type: 'http', implType: 'DNSSD' })
else zeroconf.stop()
})
// later: subscription.remove()- Wait about 500 ms between
stop()and the nextscan(). - Retry a scan that found nothing after a few seconds (avoid scans shorter than about 3 seconds).
- Avoid calling
stop()when no scan is running; track whether you are scanning.
Creating extra Zeroconf instances does not work around NSD issues: each instance runs its own scan on the same system service.
With NSD, Android exposes the mDNS host name only on Android 16+. Use implType: 'DNSSD' if you need it on older versions. Connect with service.ipv4[0] either way.
NSD returns a single address before Android 14. DNSSD returns all resolved addresses.
- Plain objects move integer-like keys (
'0','1') first. Pass[key, value]pairs instead. - With
NSDon Android the system decides the order. UseDNSSDif order matters.
- Check the device actually publishes TXT records (for example with
dns-sd -L "<name>" _http._tcpon a Mac). - On iOS, entries over 255 bytes are dropped and reported with
'TXT_ENTRY_TOO_LONG'.
Another service already used it, so a new name was picked. Use the name publishService() resolves with.
A killed process cannot announce its departure. Other devices drop the service when its mDNS records expire. Services are unpublished automatically on a normal teardown or reload.
Every instance keeps receiving native events (its own scan's events, or all scan events if it never scanned) until you call removeDeviceListeners(). Clean up on unmount (see React Integration).
Does it work with the New Architecture? Yes, it is tested with Expo SDK 54 and the New Architecture.
Can I run two scans at once?
Yes. Each Zeroconf instance runs its own scan and receives only its own scan's events; each useZeroconf hook does the same. On Android, NSD and DNSSD scans can even run concurrently. On iOS, list every scanned type in NSBonjourServices. See Multiple scans.
Does it work on macOS or tvOS? The podspec supports macOS 10.15 and tvOS 13.4. See Platform Support.
Do I need to request Android permissions at runtime?
Not before Android 17. On Android 17, apps targeting API 37 (or declaring the permission) need ACCESS_LOCAL_NETWORK: request it with checkLocalNetworkAccess(), see Permissions and Setup.
Can I list every service type on the network (_services._dns-sd._udp)?
Yes on Android, with scanServiceTypes() or useServiceTypes(). On iOS it requires the multicast entitlement from Apple. See Listing service types.
How do I reconnect to a device I found before?
Resolve it by name with resolveService(), no scan needed. See Resolving a single service.
Still stuck? Open an issue with the platform, OS version, implType, the service type, and the domain and code of any error.
Documentation for react-native-zeroconf 0.17. Found a mistake? Open an issue. | Home | API Reference | Troubleshooting