[英]Add Android Run/Debug configuration for Flutter project
I am working with a Flutter example project where it shows how to share a FlutterView inside an Android application (and iOS also).我正在处理一个 Flutter 示例项目,它展示了如何在 Android 应用程序(以及 iOS)中共享 FlutterView。
While working with it I tried this:在使用它时,我试过这个:
I make changes to the android project like changing the theme color, if I do hot-reload/run for main.dart
I don't see the changes reflected in the running app.我对 android 项目进行了更改,例如更改主题颜色,如果我为
main.dart
执行热重载/运行,我看不到正在运行的应用程序中反映的更改。 I have to stop it from Android Studio and run the main.dart
again to see the changes.我必须从 Android Studio 停止它并再次运行
main.dart
以查看更改。
To solve the issue I was thinking to add a run/debug configuration
for Android app
module.为了解决这个问题,我想为 Android
app
模块添加一个run/debug configuration
。 So that I could run android app
and not main.dart
.这样我就可以运行 android
app
而不是main.dart
。
Is there a way how to achieve this in Android Studio?有没有办法在 Android Studio 中实现这一点?
One solution for me was to open the android
(/flutter_view/android/app) project from a new window in Android studio.对我来说,一种解决方案是从 Android Studio 的新窗口中打开
android
(/flutter_view/android/app) 项目。 I could run the app this way.我可以这样运行应用程序。
(But here I encountered another issue in case anyone has the solution). (但在这里我遇到了另一个问题,以防万一有人有解决方案)。
According to my understanding you face problems when you open your project and try to run.根据我的理解,当您打开项目并尝试运行时,您会遇到问题。 Android studio asks you to configure your project to be able to run...
Android Studio 要求您配置您的项目以能够运行...
It's easy to solve near to run button you will find "add configuration" button just press then from left side select "flutter" and put in the field "entrypoint" your main Dart file path main.dart... EX.在运行按钮附近很容易解决,你会发现“添加配置”按钮,然后从左侧选择“flutter”并在“entrypoint”字段中放入你的主要Dart文件路径main.dart ... EX。 E:/project/lib/main.dart....
E:/project/lib/main.dart....
Then from top right corner press "create configuration"... That's it.然后从右上角按“创建配置”...就是这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.