You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

重装Android Studio后Flutter项目Gradle运行报错(Exit code 1)

Gradle Build Error: java.net.BindException: Address already in use When Debugging Flutter on Redmi 4

Problem Description

After reinstalling Android Studio, I tried launching my Flutter app (lib\main.dart) in debug mode on my Redmi 4, but ran into this Gradle build failure:

Launching lib\main.dart on Redmi 4 in debug mode...
Initializing gradle...
[{"event":"app.progress","params":{"appId":"4a13515b-84ae-422f-af52- 5d0ab7112e30","id":"1","progressId":null,"message":"Resolving dependencies..."}}]Resolving dependencies...
* Error running Gradle: Exit code 1 from: C:\Users\RAJESH\AndroidStudioProjects\flutte\android\gradlew.bat app:properties:
FAILURE: Build failed with an exception.
* What went wrong:
java.net.BindException: Address already in use: Cannot bind
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or -- debug option to get more log output.
* Get more help at https://help.gradle.org
Finished with error: Please review your Gradle project setup in the android/ folder.

Fixed It! Here's What Worked

After digging into the issue, I identified two root causes:

  • Slow/unstable network: Gradle couldn't resolve dependencies properly due to poor network speed
  • Stale build files: Old cached files in the project's build directory were causing connection conflicts

To resolve the problem, I took these steps:

  • Deleted the entire build folder inside the android directory of my Flutter project
  • Switched to a stable network connection to ensure dependency resolution completes smoothly
  • Restarted Android Studio and re-launched the app in debug mode

That fixed the bind exception, and the app ran successfully on my Redmi 4.

内容的提问来源于stack exchange,提问作者Rajesh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:15:03