简体   繁体   English

为 Flutter 项目添加 Android Run/Debug 配置

[英]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.

相关问题 如何为 Android Instrumented Tests 的运行配置调试或解决“错误:当前项目无法运行”? - How to debug or resolve "Error: The current project can not be run" for Run Configuration for Android Instrumented Tests? 无法在 ARM Mac 上的 IntelliJ 中的 Android 模拟器上运行 Flutter 项目,说该模拟器不适用于“main.dart”配置 - Cannot run Flutter project on Android emulator in IntelliJ on ARM Mac, says that the emulator is not applicable for the "main.dart" configuration Flutter-将lib Flutter添加到Project Android - Flutter - Add lib Flutter to Project Android 无法运行或调试SVN android项目 - Can't run or debug SVN android project Android Studio 运行/调试配置错误:未指定模块 - Android Studio Run/Debug configuration error: Module not specified 存储android运行/调试配置IntelliJ idea和svn - Store android run/debug configuration IntelliJ idea and svn 无法在android studio中运行flutter项目 - Cant run flutter project in android studio 无法再使用 Android Studio 运行 Flutter 项目 - Run a Flutter Project with Android Studio is not possible anymore 运行 Flutter 项目的 android Studio 出现问题 - Problem with android Studio with run a Flutter project 无法将依赖项添加到 flutter 中的 android 项目 - Not able to add dependency to android project in flutter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM