android

running gradle task assembledebug stuck

Here is solution in my case.

  1. Open your flutter Project directory.
  2. Change directory to android directory in your flutter project directory cd android
  3. clean gradle ./gradlew clean
  4. Build gradle ./gradlew build or you can combine both commands with just ./gradlew clean build (Thanks @daniel for the tip)
  5. Now run your flutter project. If you use vscode, press F5. First time gradle running assembleDebug will take time.

PS: Delete gradle in case of all that steps don’t work

PANIC: Missing emulator engine program for ‘x86’ CPU.

emulator -avd xx

一直报错:

PANIC: Missing emulator engine program for ‘x86’ CPU.

最终找到原因:

在创建虚拟机的时候,AS会默认推荐下载带Google APIs的x86 Images,由于大陆对google的限制,所以会导致报错。

解决办法,下载不带Google APIs的x86 Images, 然后再重启终端,重新输入命令,成功启动安卓虚拟机。