When I developed flutter app on android, I encountered problem that shows “Running Gradle task ‘assembleDebug’” forever.
I share how to solve this problem.
Environment
OS: Windows 10
flutter: 2.10.2
Android Studio: 2021.1.1 Patch 1
Solution
Open flutter project using Android studio.
And then click the following instructions.File -> Project Structure
Project Settings -> Project -> Project SDK
Change <No SDK> to Android API *.
Before:

Project Settings -> Modules -> Module SDK on Dependecies tab.
Change <No SDK> to Android API *.
Before:

Finally build this project. Probably you may complete to build a few minutes later.