If Flutter app is stuck at “Running Gradle task ‘assembleDebug'”, try these steps to resolve it:

1. Check Internet Connection

Gradle might be downloading dependencies. Ensure you have a stable internet connection.

2. Run with –verbose Flag

Run the command with verbose logging to check for detailed errors:
flutter run --verbose

3. Delete .gradle and .idea Folders

Run the following commands in your project root:
rm -rf android/.gradle android/.idea
rm -rf ~/.gradle

Then run:
flutter clean
flutter pub get

4. Check for Flutter and Dart Updates

Ensure you’re using the latest stable version:
flutter upgrade

5. Invalidate Cache & Restart in Android Studio

Open Android Studio
Go to File > Invalidate Caches / Restart
Select Invalidate and Restart

6. Manually Run Gradle Build

Try running Gradle separately:
cd android
./gradlew assembleDebug --stacktrace
This will show specific Gradle errors.

7. Check Java Version

Make sure you’re using a compatible Java version (Java 11 recommended for Flutter).
java -version
If needed, update Java and set the correct JAVA_HOME path.

8. Check for Dependency Conflicts

Open android/build.gradle and ensure dependencies are compatible with your Flutter version.

9. Switch to Stable Channel (If on Beta/Dev)

flutter channel stable
flutter upgrade

10. Kill Background Gradle Processes

If Gradle is stuck, try killing it:
killall -9 java

11. Increase Gradle Memory (If It’s a Large Project)

Edit android/gradle.properties and add:
org.gradle.jvmargs=-Xmx4096M

After trying these, run:
flutter clean
flutter pub get
flutter run

Need Help With Flutter Development?

Work with our skilled Flutter developers to accelerate your project and boost its performance.

Hire Flutter Developers

Support On Demand!

Related Q&A