Macos and Android: Device not found

Hi all,

I’m running Syncthing on my iMac and an Android device. Unless I allow ‘relaying’ both devices can’t see each other on my local network. The Firewall on my Mac is disabled. I haven’t done any configuration on the Android device, just added the iMac as device to it.

Some logging: some.log (1.7 KB)

…and screenshots:

Discovery 2/2 on the Mac sounds like you’ve disabled some discovery methods there. I think the android device can’t use local discovery by default / any more / on modern android / something, I’m not the android dude. The combo of those two may leave you without any discovery methods in common between the two devices.

I’d also suspect that relaying is not the culprit here, but if you have disabled “Global Discovery”, that could cause direct connection failure. Local discovery is broken on recent Android versions because Google decided to block certain kinds of network packets. Without global discovery, your Android devices cannot find other devices on the same LAN / WLAN.

Alternatively, you could also simply hard-code the IP address (or hostname if the IP is dynamic) of the iMac, which is probably stationary, on Android, and then it should use that to connect on the local network.

Enabling “Global Discovery” did the trick, thank you all!

The next problem is that I can’t see the shared folder on the Android device. There is an info text in the folder configuration on my iMac that says ‘The remote device has not accepted sharing this folder.’ How would I accept that? I can’t find any way on the Android device accept a folder that has not been announced.

Syncthing on Android works under the same principles as on the desktop. If you don’t see a notification and nothing is displayed in the app for some reason (screenshots would be welcome), you can always try to open the Web GUI (available from the left slide-out menu), which will present you with the exact same interface as you see on the desktop.

@tomasz86: I had no idea I also have to use the web interface sometimes. Everything seems to work now as I expected it. Thanks again, everyone.

But Local Discovery still works on MacOS, and that’s how I always manage to connect Android and MacOS, but for some reason this does not work in a secondary Android user profile, so only Global Discovery can fix the issue there. Yes, it’s true that Local Discovery between two Androids won’t work, but if only one participant is not on Android, it works and has always been, but I guess a secondary user profile breaks Local Discovery entirely.

Even enabling Global Discovery on Android won’t fix the problem then, both parties need to have Global Discovery enabled for it to work, it’s disappointing, because I was hoping to avoid any dependencies. (I need Syncthing on multiple user profiles in Android)

I guess that I need to host a Discovery Server now, but I was planning to move one instance into my infrastructure anyways.

The global discovery option disables both looking up from the servers and announcing the own addresses to them. So both devices need to have it enabled for the mechanism to work.

Local discovery is currently broken on Android because the operating system blocks broadcast / multicast UDP network packets. I suspect that they are filtered out both when sending and receiving, so effectively Android devices cannot use local discovery at all, no matter what the other side does.

Instead of using a self-hosted discovery server, you could also simply hard-coded LAN addresses to be tried in the remote device configuration. If only the Mac has a fixed LAN IP, it’s enough to put that into the addresses field on the Android Syncthing. If both are fixed, you can even do so on both ends. (As previously suggested by @tomasz86)

Just for the record, another workaround is to run Synching on Android with root access. This way, local discovery just works and there’s no need to do anything else.

@acelomb Thanks André. I have no idea, why it worked previously then. For some reason my situation got worse. Today I was on one of my Android profiles, I had to enable all 4 settings (NAT traversal, local and global discovery and relaying) on both ends and then I had to wait for about 10 minutes, until my Android device connected to my Mac. It’s not the first time that I have this issue, there are days in which the sync cannot be established and I have to sit it out. Every time this happens I just have to be patient several minutes, and it will connect eventually.

I have many profiles and each profile results in a different device for SyncThing, so this is a deal breaker for me atm. It’s a really frustrating experience.

How can I figure out what’s going on? Apparently, my configuration is not at fault, or it would not connect at all, am I right?

With multiple profiles on Android, you essentially run multiple instances of Syncthing on the same device. I do this too, but to make them all work smoothly, some special handling is required.

When it comes to the first (main) profile, you can just leave everything at default. When it comes to the second one though, I usually always change the following settings.

  1. GUI listen address from the default 8384 to something else, e.g. 8385.
  2. Sync Protocol Listen Address from default (which equals to tcp://0.0.0.0:22000, dynamic+https://relays.syncthing.net/endpoint, quic://0.0.0.0:22000) to tcp://0.0.0.0:22001, dynamic+https://relays.syncthing.net/endpoint, quic://0.0.0.0:22001.
  3. The port in Local Announce MC Addr and Local Announce Port from the default 21027 to 21028. These two are only accessible via Advanced Configuration.

With the above, my Listeners and Discovery look like this in all Syncthing instances.

If you need to run more than two instances, then just change the addresses and ports accordingly, so that there is no collision between them.

@tomasz86 Thanks for bringing my attention to these settings. It seems the Android client shuffled all ports for each profile, but didn’t change local discovery settings. Default value of Local Announce MC Addr is [ff12::8384]:21027, so I assume the 8384 is the GUI listen address port which I need to change as well? The issue was magically solved before fixing those settings, I did it anyways and I will continue to look at it, maybe this will help, if not, I’m going to reply here again.

Today I have added a new Android device, both, global and local discovery are enabled, both devices are added to each other, same network, no connection.

it says “no recent network activity”:

On this device I don’t use multiple user profiles.

After that, I enabled NAT Traversal and Relaying on both ends, waited 5 minutes and it suddenly works and both devices found each other. Something is broke.