简体   繁体   English

如何将 Flutter 与 Genymotion 连接起来?

[英]How do I connect Flutter with Genymotion?

I have a problem with running my Flutter app on Android emulator using Genymotion.我在使用 Genymotion 在 Android 模拟器上运行我的 Flutter 应用程序时遇到问题。

After launch emulator, I have tried to "flutter run", but it didn't work.启动模拟器后,我尝试“颤动运行”,但没有成功。 Console shows "No connected devices."控制台显示“没有连接的设备”。

So how can I connect flutter with Genymotion?那么如何将 Flutter 与 Genymotion 联系起来呢? Could you tell me something?你能告诉我一些事情吗? https://gyazo.com/7d75068683c043922c5fff75377e9817 https://gyazo.com/c9ccae04ffdfba3fa66fa6ff7e038e8f https://gyazo.com/7d75068683c043922c5fff75377e9817 https://gyazo.com/c9ccae04ffdfba3fa66fa6ff7e038e8f

The reason why I want to use Genymotion is Android Studio is too heavy.我之所以要使用 Genymotion 是因为 Android Studio 太重了。

But I wonder Flutter doesn't work on Genymotion without Android Studio.但我想知道 Flutter 在没有 Android Studio 的情况下无法在 Genymotion 上运行。

  1. Install the Genymotion plug-in for Android Studio (Within AS: Tools > SDK Manager > Plugins > Genymotion).安装适用于 Android Studio 的 Genymotion 插件(在 AS 中:Tools > SDK Manager > Plugins > Genymotion)。 Restart AS重启 AS

  2. Configure the SDK within Genymotion (Genymotion > Preferences > ADB > Use custom Android SDK tools) then use the path /Users/{Your user}/Library/Android/sdk (default location after installing AS)在 Genymotion 中配置 SDK(Genymotion > Preferences > ADB > Use custom Android SDK tools)然后使用路径 /Users/{Your user}/Library/Android/sdk (安装 AS 后的默认位置)

  3. Create a new device within Genymotion在 Genymotion 中创建一个新设备

  4. Configure correct Genymotion path within AS:在 AS 中配置正确的 Genymotion 路径:

    a.一个。 View > Toolbars (to display the Genymotion icon if not default appearing)查看 > 工具栏(如果不是默认出现,则显示 Genymotion 图标)

    b.湾。 Press the Genymotion icon in the toolbar (appears next to magnifying glass at the right hand side)按工具栏中的 Genymotion 图标(出现在右侧的放大镜旁边)

    c. C。 Point the path to the Genymotion folder location (eg: /Applications/Genymotion)将路径指向 Genymotion 文件夹位置(例如:/Applications/Genymotion)

    d. d。 Close the box关闭盒子

Now you are set up, so in future press the icon, select your emulator and run to launch within Android Studio.现在你已经设置好了,所以以后按下图标,选择你的模拟器并运行在 Android Studio 中启动。 This will be detected by flutter when trying run apps using flutter run command.在尝试使用 flutter run 命令运行应用程序时,flutter 会检测到这一点。

First Start the Genymotion emulator which you already downloaded an image and installed.首先启动您已经下载并安装的 Genymotion 模拟器。

When emulator status is ON the open a command and run the following command:当模拟器状态为ON时,打开命令并运行以下命令:

flutter devices

If you see the installed image on output then like below then everything is fine:如果您在输出中看到已安装的图像,则如下所示,那么一切都很好:

PS F:\osx> flutter devices PS F:\osx> 颤振设备

1 connected device: 1 个连接的设备:

Samsung Galaxy S9 • 192.168.150.101:5555 • android-x86 • Android 8.0.0 (API 26)三星 Galaxy S9 • 192.168.150.101:5555 • android-x86 • Android 8.0.0 (API 26)

Simply select the device on VScode or Android Studio and hit the run.只需在VScodeAndroid Studio上选择设备并点击运行。

1) Install genymotion correctly. you can see here: [https://www.genymotion.com/plugins/][1]
  1. install the Genymotion plugin for Android Studio为 Android Studio 安装 Genymotion 插件
2-1) In Android Studio, go to File/Settings (for Windows and Linux) or to Android Studio/Preferences (for Mac OS X)
2-2) Select Plugins and click Browse Repositories.

2-3) Right-click on Genymotion and click Download and install.

This is what you need to do if the genymotion icon don't apper.如果 genymotion 图标不出现,这就是您需要做的。

2-4) To see Genymotion plugin icon, display the toolbar by clicking View > Toolbar.

After the last step, I can see the icon now and run my app with genymotion.在最后一步之后,我现在可以看到图标并使用 genymotion 运行我的应用程序。

I hope this helps your problem, since after struggling to find it works for me我希望这对您的问题有所帮助,因为在努力找到它对我有用之后

execute:执行:

flutter run --enable-software-rendering颤振运行--启用软件渲染

from Run/Edit configurations menu in IDE从 IDE 中的运行/编辑配置菜单

source: https://github.com/flutter/flutter/issues/11094#issuecomment-372662053来源: https ://github.com/flutter/flutter/issues/11094#issuecomment-372662053

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM