简体   繁体   English

如何在没有 Android Studio 的情况下更新 Android 模拟器?

[英]How to update Android emulator without Android Studio?

I don't have Android Studio, just the Android SDK.我没有 Android Studio,只有 Android SDK。 When I launch one of my Android emulators using the Android Virtual Devices (AVD) Manager, I get the following message:当我使用 Android 虚拟设备 (AVD) 管理器启动我的一个 Android 模拟器时,我收到以下消息:

Your emulator is out of date, please update by launching Android Studio .您的模拟器已过期,请启动 Android Studio 进行更新

启动 Android 模拟器对话框

According to the steps, it seems that one could update the emulator even without Android Studio just by using the Android SDK Manager.根据步骤,即使没有Android Studio,似乎也可以通过使用Android SDK Manager来更新模拟器。 But there is no SDK Tools tab.但是没有 SDK 工具选项卡。

在此处输入图像描述

Is the SDK Manager which is launched as a standalone application different from the SDK Manager available in the Android Studio?作为独立应用程序启动的 SDK 管理器与 Android Studio 中可用的 SDK 管理器是否不同?

Also, as you can see, everything is up-to-date and the version of Android SDK Tools is even newer than the one that is offered for downloading on the Android website (25.2.3 at the time of writing this question).此外,如您所见,所有内容都是最新的,并且 Android SDK 工具的版本甚至比Android 网站上提供的可供下载的版本更新(在撰写此问题时为 25.2.3)。

So how do I update the emulator?那么如何更新模拟器呢? I don't need/want Android Studio.我不需要/想要 Android Studio。

The standalone GUI SDK Manager is deprecated as of SDK Tools v25.2.3 .SDK Tools v25.2.3 起,独立 GUI SDK 管理器已弃用。

The instructions you see in the "Starting Android Emulator" run window are specific to updating via Android Studio.您在“启动 Android 模拟器”运行窗口中看到的说明特定于通过 Android Studio 进行更新。 The SDK Manager inside of Android Studio is different than the standalone tool. Android Studio 中的 SDK Manager 与独立工具不同。 We added new SDK packages that the old SDK Manager does not understand how to process nor update, including the new Emulator.我们添加了旧 SDK Manager 不了解如何处理或更新的新 SDK 包,包括新的 Emulator。

You have two ways going forward to update the emulator:您有两种方法可以更新模拟器:

  1. Use the new command line SDK Manager: $ ./sdkmanager --update Read more here使用新的命令行 SDK 管理器: $ ./sdkmanager --update 在此处阅读更多

  2. Use the new SDK Manager in Android Studio 在 Android Studio 中使用新的SDK Manager

Based on the window output, it also looks like your AVDs might be old, so you may want to create new AVDs or update for the latest features and better emulator performance & stability.根据窗口输出,您的 AVD 看起来也可能很旧,因此您可能需要创建新的 AVD 或更新以获取最新功能以及更好的模拟器性能和稳定性。

SDK Tools Release Notes saying it has been deprecated: SDK 工具发行说明说它已被弃用: 在此处输入图片说明

It is possible to update Android emulator without Android Studio using what I previously described as the "forced manual upgrade" and following the discussion in that post, I figured out some things concerning the standalone SDK:可以使用我之前描述的“强制手动升级”在没有 Android Studio 的情况下更新 Android 模拟器,并按照该帖子中的讨论,我想出了一些关于独立 SDK 的事情:

It seems the emulator (originally distributed as part of the Android SDK Tools) is no longer updated since version 25.2.3似乎模拟器(最初作为 Android SDK 工具的一部分分发)自版本 25.2.3 起不再更新

Thus the workaround involves a " manual/forced upgrade " of emulator tools.因此,解决方法涉及仿真器工具的“手动/强制升级”。 Currently I successfully upgraded to version 27.3.8 (and running Android 9 smoothly).目前我成功升级到27.3.8版本(并且顺利运行Android 9)。

The workaround解决方法

Firstly make sure the base packages are still intact, and upgrade the emulator as follows:首先确保基础包完好无损,然后按如下方式升级模拟器:

Instructions指示

  • Download the latest (or suitable emulator) from the links supplied below下面提供的链接下载最新的(或合适的模拟器)
  • When done, decompress the downloaded emulator.zip file and extract the emulator package to %USERPROFILE%\\Android\\android-sdk\\tools or relevant path (yes you have to merge it into that folder, since the emulator doesn't have all libraries and files)完成后,解压下载的 emulator.zip 文件并将模拟器包解压到%USERPROFILE%\\Android\\android-sdk\\tools相关路径(是的,您必须合并到该文件夹​​中,因为模拟器没有所有库和文件)
  • After this your emulator will be updated (to 27.3.8 in my case):在此之后,您的模拟器将更新(在我的情况下为 27.3.8):

在此处输入图片说明

Android SDK manager (GUI) Android SDK 管理器 (GUI)

Now prepare your AVD as usual:现在像往常一样准备你的 AVD:

在此处输入图片说明

Android AVD manager安卓 AVD 管理器


Important links重要链接

Base and Emulator tools(zip)基础和模拟器工具(zip)

Special thanks to androiddev for providing links for linux, eaglemt and Vladyslav Panchenko for providing the links to repos and mostly important for mac os links.特别感谢androiddev提供了 linux、 eaglemtVladyslav Panchenko的链接,他们提供了 repos 的链接,对于 mac os 链接最重要。


This is what you can do to update to the most recent version that can be found here: https:\/\/developer.android.com\/studio\/releases\/emulator<\/a>这是您可以更新到最新版本的方法,可在此处找到: https<\/a> : \/\/developer.android.com\/studio\/releases\/emulator<\/a>

# go to your SDK directory
cd $ANDROID_HOME 

# remove old emulator version
rm -r emulator

# this will fetch the version from Canary channel
# keep in mind that this might be unstable
sdkmanager "emulator" --channel=3

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

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