Android Studio中的Flutter:Build Bundle/APK变灰 [英] Flutter in Android Studio: Build Bundle/APK greyed out
问题描述
我通过以下链接安装了Flutter和Android Studio: https://flutter.dev/docs/get-started/editor
I installed Flutter and Android Studio following this link here: https://flutter.dev/docs/get-started/editor
我已经用flutter编码了两个月了,可以在模拟器或连接的设备上运行我的应用程序了.
I've been coding in flutter for two months now and can run my app in simulator or on a connected device no problem.
但是,当我尝试通过构建"->构建捆绑包/APK"实际构建apk时,此选项显示为灰色.
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
Android Studio: 3.3.2
推荐答案
如果您正在运行Flutter项目,则无法使用Android Studio中的Build
选项来构建apk.
You can't build apk using Build
option in Android Studio if you are running your Flutter project.
有2种解决方案来构建它.
There are 2 solutions to build it.
-
在终端中输入
flutter build apk
(这将为发行版而不是调试版生成APK)
In terminal, write
flutter build apk
(this will build apk for release version not the debug version)
在Android Studio中打开模块,然后可以使用Android Studio的Build
选项来构建调试apk.
Open your module in Android Studio and you can use Build
option of the Android studio to build the debug apk.
对于选项2,您可以转到build.gradle
文件,并且您应该在Android Studio中看到一个选项,要求您单独打开模块(请参见屏幕截图).点击此选项,然后您就可以在两个调试器中构建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.
这篇关于Android Studio中的Flutter:Build Bundle/APK变灰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!