Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with "Could not connect to the Gradle daemon" and IP address when running a Flutter app

I'm trying to launch the Flutter app (Flutter's version 2.10.3) on a Mac M1.

I made the next updates to the file android/app/build.gradle:

Some of my Android settings:

  • compileSdkVersion from 28 to 32
  • targetSdkVersion from 28 to 32
  • android/build.gradle: ext.kotlin_version = '1.5.31'
  • android/gradle/wrapper/gradle-wrapper.properties: distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip

I runned the app on an emulator API 32 (Android 12L), but the Gradle throwed an exception.

The log:

...
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
Could not connect to the Gradle daemon.
Daemon uid: fd2e13e6-2566-45f5-8766-4fedc7775cb0 with diagnostics:
Daemon pid: 11467
  log file: /Users/<username>/.gradle/daemon/6.9/daemon-11467.out.log
----- Last  20 lines from daemon log file - daemon-11467.out.log -----
2022-04-22T14:07:40.973+0200 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /fe80:0:0:0:4a:4965:170f:6161%en0
2022-04-22T14:07:40.973+0200 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /192.168.1.251
2022-04-22T14:07:40.973+0200 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface lo0
2022-04-22T14:07:40.974+0200 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? true
2022-04-22T14:07:40.974+0200 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Ignoring remote address on loopback interface /fe80:0:0:0:0:0:0:1%lo0
2022-04-22T14:07:40.974+0200 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /0:0:0:0:0:0:0:1%lo0
2022-04-22T14:07:40.974+0200 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /127.0.0.1
2022-04-22T14:07:40.976+0200 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpIncomingConnector] Listening on [bf4f42c3-7339-4aa4-8277-33e3ae19a1aa port:55627, addresses:[localhost/127.0.0.1]].
2022-04-22T14:07:40.982+0200 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] Daemon starting at: Fri Apr 22 14:07:40 CEST 2022, with address: [bf4f42c3-7339-4aa4-8277-33e3ae19a1aa port:55627, addresses:[localhost/127.0.0.1]]
2022-04-22T14:07:40.982+0200 [INFO] [org.gradle.launcher.daemon.server.DaemonRegistryUpdater] Advertising the daemon address to the clients: [bf4f42c3-7339-4aa4-8277-33e3ae19a1aa port:55627, addresses:[localhost/127.0.0.1]]
2022-04-22T14:07:40.982+0200 [DEBUG] [org.gradle.launcher.daemon.server.DaemonRegistryUpdater] Advertised daemon context: DefaultDaemonContext[uid=fd2e13e6-2566-45f5-8766-4fedc7775cb0,javaHome=/Applications/Android Studio.app/Contents/jre/Contents/Home,daemonRegistryDir=/Users/<username>/.gradle/daemon,pid=11467,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.prefs/java.util.prefs=ALL-UNNAMED,-Xmx1536M,-Dfile.encoding=UTF-8,-Duser.country=NL,-Duser.language=ca,-Duser.variant]
2022-04-22T14:07:40.983+0200 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Storing daemon address: [bf4f42c3-7339-4aa4-8277-33e3ae19a1aa port:55627, addresses:[localhost/127.0.0.1]], context: DefaultDaemonContext[uid=fd2e13e6-2566-45f5-8766-4fedc7775cb0,javaHome=/Applications/Android Studio.app/Contents/jre/Contents/Home,daemonRegistryDir=/Users/<username>/.gradle/daemon,pid=11467,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.prefs/java.util.prefs=ALL-UNNAMED,-Xmx1536M,-Dfile.encoding=UTF-8,-Duser.country=NL,-Duser.language=ca,-Duser.variant]
2022-04-22T14:07:40.987+0200 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
2022-04-22T14:07:40.988+0200 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2022-04-22T14:07:40.993+0200 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2022-04-22T14:07:40.993+0200 [LIFECYCLE] [org.gradle.launcher.daemon.server.Daemon] Daemon server started.
2022-04-22T14:07:40.994+0200 [DEBUG] [org.gradle.launcher.daemon.bootstrap.DaemonStartupCommunication] Completed writing the daemon greeting. Closing streams...
2022-04-22T14:07:40.996+0200 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] stopOnExpiration() called on daemon
2022-04-22T14:07:40.996+0200 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] awaitExpiration() called on daemon
2022-04-22T14:07:40.996+0200 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] daemon is running. Sleeping until state changes.
----- End of the daemon log -----

...
like image 553
Guillem Puche Avatar asked Nov 27 '25 02:11

Guillem Puche


1 Answers

The problem disappears when I change the settings of the ProtonVPN to a less secure configuration. There's a feature that is Kill Switch that protects your IP address in case you unexpectedly lose the connection to a ProtonVPN server. [...] This means that even though you can’t use the Internet until ProtonVPN reconnects, your IP address and DNS queries are safe from being exposed.

like image 90
Guillem Puche Avatar answered Nov 29 '25 18:11

Guillem Puche



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!