Flutter in Android Studio: Build Bundle/APK greyed

2019-06-08 20:52发布

I installed Flutter and Android Studio following this link here: https://flutter.dev/docs/get-started/editor

I've been coding in flutter for two months now and can run my app in simulator or on a connected device no problem.

But when I try to actually build an apk via "Build" --> "Build Bundle(s) / APK", this option is greyed out.

Android Studio: 3.3.2

1条回答
兄弟一词,经得起流年.
2楼-- · 2019-06-08 21:20

You can't build apk using Build option in Android Studio if you are running your Flutter project.

There are 2 solutions to build it.

  1. In terminal, write flutter build apk (this will build apk for release version not the debug version)

  2. Open your module in Android Studio and you can use Build option of the Android studio to build the debug apk.

For option 2, you can go to build.gradle file and you should see an option in Android Studio asking you to open the module separately (see the screenshot) Tap on this option and you can then build your apk in both debug and release mode.

enter image description here

查看更多
登录 后发表回答