ProtonVPN sync - Could not connect to the Gradle daemon

I’m an Android developer using Gradle, and I just started running ProtonVPN on my personal machine. There’s a nice Kill Switch feature - internet is disabled when VPN connection drops to prevent IP leaks. (I’ve also been told the Kill Switch blocks all LAN connections, which could be relevant here.)

With Kill Switch on, I can’t run a Gradle sync in my project. It always fails with the message Could not connect to the Gradle daemon. I think the connection is simply being block as an ‘unsafe connection’ because it’s not routed through the VPN - but that doesn’t make sense to me as it’s a locally hosted daemon. There’s no external connection, right? (I’m definitely not a network expert.)

I’m trying to find out the following:

  • For those familiar with ProtonVPN, is it possible to sync with Kill Switch on?
  • Is there a way around this through proxying or another method so I can (again) keep Kill Switch on?
  • Any ideas at all here?
EXPAND ME TO SEE OUTPUT LOGS
Starting a Gradle Daemon, 15 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
Could not connect to the Gradle daemon.
Daemon uid: dfa58bf1-9dc8-41b2-9e05-1d3c2b6487ac with diagnostics:
Daemon pid: 47724
  log file: /Users/[username]/.gradle/daemon/7.5.1/daemon-47724.out.log
----- Last  20 lines from daemon log file - daemon-47724.out.log -----
2022-09-26T21:26:25.088-0500 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
2022-09-26T21:26:25.088-0500 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /192.168.0.4
2022-09-26T21:26:25.089-0500 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface lo0
2022-09-26T21:26:25.089-0500 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? true
2022-09-26T21:26:25.089-0500 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Ignoring remote address on loopback interface /fe80:0:0:0:0:0:0:1%lo0
2022-09-26T21:26:25.089-0500 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /0:0:0:0:0:0:0:1%lo0
2022-09-26T21:26:25.089-0500 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /127.0.0.1
2022-09-26T21:26:25.091-0500 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpIncomingConnector] Listening on [77f01216-b83a-4c7f-8b6f-90a4be42dfe6 port:51410, addresses:[localhost/127.0.0.1]].
2022-09-26T21:26:25.094-0500 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] Daemon starting at: Mon Sep 26 21:26:25 CDT 2022, with address: [77f01216-b83a-4c7f-8b6f-90a4be42dfe6 port:51410, addresses:[localhost/127.0.0.1]]
2022-09-26T21:26:25.094-0500 [INFO] [org.gradle.launcher.daemon.server.DaemonRegistryUpdater] Advertising the daemon address to the clients: [77f01216-b83a-4c7f-8b6f-90a4be42dfe6 port:51410, addresses:[localhost/127.0.0.1]]
2022-09-26T21:26:25.095-0500 [DEBUG] [org.gradle.launcher.daemon.server.DaemonRegistryUpdater] Advertised daemon context: DefaultDaemonContext[uid=dfa58bf1-9dc8-41b2-9e05-1d3c2b6487ac,javaHome=/Library/Java/JavaVirtualMachines/temurin-18.jdk/Contents/Home,daemonRegistryDir=/Users/[username]/.gradle/daemon,pid=47724,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
2022-09-26T21:26:25.095-0500 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Storing daemon address: [77f01216-b83a-4c7f-8b6f-90a4be42dfe6 port:51410, addresses:[localhost/127.0.0.1]], context: DefaultDaemonContext[uid=dfa58bf1-9dc8-41b2-9e05-1d3c2b6487ac,javaHome=/Library/Java/JavaVirtualMachines/temurin-18.jdk/Contents/Home,daemonRegistryDir=/Users/[username]/.gradle/daemon,pid=47724,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
2022-09-26T21:26:25.100-0500 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
2022-09-26T21:26:25.101-0500 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-09-26T21:26:25.103-0500 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-09-26T21:26:25.103-0500 [LIFECYCLE] [org.gradle.launcher.daemon.server.Daemon] Daemon server started.
2022-09-26T21:26:25.104-0500 [DEBUG] [org.gradle.launcher.daemon.bootstrap.DaemonStartupCommunication] Completed writing the daemon greeting. Closing streams...
2022-09-26T21:26:25.106-0500 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] stopOnExpiration() called on daemon
2022-09-26T21:26:25.106-0500 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] awaitExpiration() called on daemon
2022-09-26T21:26:25.106-0500 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] daemon is running. Sleeping until state changes.
----- End of the daemon log -----

I can absolutely just work with Kill Switch off, but I don’t really want to if I can avoid it. I just like the safer anonymity of the feature.