简体   繁体   English

如何在真实设备上运行 flutter 应用程序,而无需每次都在手机上安装 sdk

[英]How to run flutter app on a real device without having to install the sdk on your phone evrytime

I use my mobile device to run my flutter applications.我使用我的移动设备运行我的 flutter 应用程序。 I know all about the hot reload but I'm so tired of having to wait every time I connect back to my phone again maybe the next day and then the app has to be re installed and the gradle task assembler has to be built again.我对热重载了如指掌,但我厌倦了每次重新连接到手机时都必须等待,也许第二天,然后必须重新安装应用程序,并且必须再次构建 gradle 任务汇编器。 Please I want to ask if there is a way to reconnect easily and a way for the apps to run easily again any time I want to work on a project again after a while.请问我是否有一种方法可以轻松地重新连接,并且有一种方法可以让应用程序在一段时间后再次处理项目时再次轻松运行。

There are a couple of alternatives to building the APK and installing it on a physical device:构建 APK 并将其安装在物理设备上有几种替代方法:

Use an emulated android device使用仿真 android 设备

You can use an android emulator.您可以使用 android 仿真器。 The easiest way to set that up is probably the graphical interface in Android Studio (see https://developer.android.com/studio/run/managing-avds ), but you can also use flutter emulators --create [--name <Name>] to create a new virtual device. The easiest way to set that up is probably the graphical interface in Android Studio (see https://developer.android.com/studio/run/managing-avds ), but you can also use flutter emulators --create [--name <Name>]创建一个新的虚拟设备。 Then use the button in the bottom right of VS Code to select that device, before launching the debugger.然后使用 VS Code 右下角的按钮到 select 该设备,然后再启动调试器。

Flutter 设备选择按钮 Flutter 设备选择菜单

Build for desktop为桌面构建

Depending on the dependencies of your app, you could try building the app for the platform you're developing on (Windows, Linux, or macOS).根据您的应用程序的依赖关系,您可以尝试为您正在开发的平台(Windows、Linux 或 macOS)构建应用程序。 This has the same visual result as an Android app, but does not need an emulator or physical device.这与 Android 应用程序具有相同的视觉效果,但不需要模拟器或物理设备。 The rendering engine is the same (Skia) on all platforms.所有平台上的渲染引擎都是相同的(Skia)。 The obvious downside is that some plugins may not be available for desktop.明显的缺点是某些插件可能不适用于桌面。

See https://docs.flutter.dev/development/platform-integration/desktop on how to set that up.有关如何设置的信息,请参阅https://docs.flutter.dev/development/platform-integration/desktop

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的Flutter真机安装不了Android? - Why can't I install Flutter app in real Android phone? 只有一种方法可以在真实的 Android 手机上运行我的 Flutter 应用程序吗? - Is there only one way to run my Flutter app on a real Android phone? 为什么Android Studio可以在真实设备上运行应用程序并安装失败? - Why can an app run in real device by Android Studio and failed by install? 无法在模拟器或真实设备中运行Flutter应用程序 - Can't run Flutter app in emulator or real device Flutter 应用无法在真机或模拟器上运行 - Flutter app can't run on real device or emulator 如何在我的真实设备上安装我的应用程序,我的设备未列出 - how to install my app on my real device,my device is not listed 如何从 Flutter 应用程序在您的手机上启动应用程序 - how to launch an app on your mobile phone from a flutter app 如何在不发布和Eclipse的情况下在真机上安装Android应用程序? - How to install an Android application on a real device without publishing and Eclipse? 未在虚拟或真实设备上安装在代码和应用程​​序下带有红线的Gradle代码 - Gradle Code having Red Line Under the Code and App not Install On Virtual Or Real Device Android:如何在不使用Android SDK工具的情况下在设备上安装APK - Android: how to install apk on device, without using android sdk tools
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM