简体   繁体   English

如何在 android 模拟器中运行 kotlin 项目

[英]How to run a kotlin project in android emulator

How to run a Kotlin project in android emulator?如何在 android 模拟器中运行 Kotlin 项目? my Kotlin environment is all set but I dont know to run the project in my android emulator in vs code today is my first day in kotlin i know nothing about it i just got a project from github and now i want to run that project in my android emulator我的 Kotlin 环境已全部设置好,但我不知道如何在我的 android 模拟器中运行该项目,今天是我在 kotlin 的第一天,我对此一无所知,我刚从 github 获得了一个项目,现在我想在我的 github 中运行该项目android 模拟器

You need Android Studio installed, and you also need to create at least 1 emulator via Android Studio.您需要安装 Android Studio,还需要通过 Android Studio 创建至少 1 个模拟器。 Then you can install a plugin from the Marketplace, and use it as follows:然后你可以从 Marketplace 安装一个插件,并按如下方式使用它:

To run Android emulators you need to have Android studio and already created the Android Virtual Devices.要运行 Android 模拟器,您需要拥有 Android studio 并且已经创建了 Android 虚拟设备。

Add the Android Studio emulator script to your settings in Visual Studio Code: You can either set the default path or specify a specific path for each operating system.将 Android Studio 模拟器脚本添加到您在 Visual Studio Code 中的设置:您可以设置默认路径或为每个操作系统指定特定路径。 The default path will always be the fallback.默认路径将始终是后备路径。

  • Default : "emulator.emulatorPath": "~/Library/Android/sdk/emulator"默认值:“emulator.emulatorPath”:“~/Library/Android/sdk/emulator”
  • Mac : "emulator.emulatorPathMac": "~/Library/Android/sdk/emulator" Mac : "emulator.emulatorPathMac": "~/Library/Android/sdk/emulator"
  • Linux : "emulator.emulatorPathLinux": "~/Android/Sdk/emulator" Linux : "emulator.emulatorPathLinux": "~/Android/Sdk/emulator"
  • Windows : "emulator.emulatorPathWindows": "\Sdk\emulator" or "C:\Users\\AppData\Local\Android\Sdk\emulator" Windows : "emulator.emulatorPathWindows": "\Sdk\emulator" 或 "C:\Users\\AppData\Local\Android\Sdk\emulator"

Your visual studio code settings are found here: File -> Preferences -> Setting -> User Setting -> Extensions -> Emulator Configuration您的 visual studio 代码设置可在此处找到:文件 -> 首选项 -> 设置 -> 用户设置 -> 扩展 -> 模拟器配置

You now have the option to start Android emulators in cold boot modus.您现在可以选择以冷启动模式启动 Android 仿真器。 Activate it in your settings in Visual Studio Code: Android Cold Boot: true在 Visual Studio Code 的设置中激活它:Android 冷启动:true

Then to run the emulator in Visual Studio:然后在 Visual Studio 中运行模拟器:

Open all commands with Cmd-Shift-P and type Emulator or click the Emulator icon in the top right.使用 Cmd-Shift-P 打开所有命令并键入 Emulator 或单击右上角的 Emulator 图标。

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

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