简体   繁体   English

卸载旧的 Android SDK 版本

[英]Uninstall old Android SDK versions

I installed Android SDK and it's taking almost 7 GB on my (relatively small) SSD.我安装了 Android SDK,它在我的(相对较小的)SSD 上占用了近 7 GB。

When I open Android SDK Manager I can see that everything is installed even older API versions.当我打开Android SDK Manager我可以看到所有东西都安装了更旧的 API 版本。

在此处输入图片说明

Same thing for the Extras : Extras东西也一样:

在此处输入图片说明

Can I safely un-install all the versions and only keep the latest one (API 17 in my case) ?我可以安全地卸载所有版本并只保留最新版本(在我的情况下为 API 17)吗?

I use Andoid SDK Tools to develop Android Apps with eclipse.我使用 Andoid SDK Tools 通过 Eclipse 开发 Android 应用程序。

Thank you.谢谢你。

Just delete the packages you want to uninstall.只需删除要卸载的软件包即可。

You may still want to retain some of the older SDK's so as to try your apps on lower platform.您可能仍希望保留一些较旧的 SDK,以便在较低平台上试用您的应用程序。 I personally keep GB(API 10), ICS(API 14) and JB(API 17).我个人保留 GB(API 10)、ICS(API 14) 和 JB(API 17)。

Also what you can try is just move the whole android SDK folder to a new location with relatively large storage, and then specify the new path in preferences in eclipse.另外你可以尝试的只是将整个android SDK文件夹移动到一个存储空间相对较大的新位置,然后在eclipse中的首选项中指定新路径。 Will save you some bandwidth, in case you later need those API's.将为您节省一些带宽,以防您以后需要这些 API。 My friend just copies from mine.我的朋友只是从我的复制品。 Data here is very costly :(这里的数据非常昂贵:(

You can deploy it, but you would have to mention it(that you want to run on lower APIs) on your manifest file.您可以部署它,但您必须在清单文件中提及它(您希望在较低的 API 上运行)。 Also any API above the targeted device will not run and will interfere with your app design.此外,目标设备上方的任何 API 都不会运行,并且会干扰您的应用程序设计。 Search for android TargetSDK version and MinimunSDK version.搜索 android TargetSDK 版本和 MinimunSDK 版本。

Select the packages that you want to uninstall选择要卸载的软件包在此处输入图片说明and click delete packages button.然后单击删除包按钮。

As for the current version (Feb 2019) here is way that works from within Android Studio:对于当前版本(2019 年 2 月),这里是在 Android Studio 中工作的方式:

  1. Open the SDK Manager (Tools -> SDK Manager).打开 SDK 管理器(工具 -> SDK 管理器)。

  2. There you see all available platforms and in "Name" a box which shows Installed [✓], Update available [–] and Not installed [ ] platforms.在那里您会看到所有可用的平台,并在“名称”中显示一个框,其中显示已安装 [✓]、更新可用 [–] 和未安装 [ ] 平台。

在此处输入图片说明

  1. If you klick on that box you can change the status.如果您点击该框,您可以更改状态。 Click until it is empty and a red x shows up.单击直到它是空的并显示一个红色的 x。 Then press Apply.然后按应用。 The platform will be uninstalled then.该平台将被卸载。

在此处输入图片说明

If you want to use the android command line tool sdkmanager to do this instead of the UI, this is the way to do it.如果您想使用 android 命令行工具sdkmanager而不是 UI 来执行此操作,这就是执行此操作的方法。

Prepare准备

Make sure that sdkmanager doesn't complain about repositories.cfg missing:确保sdkmanager不会抱怨repositories.cfg丢失:

mkdir -p ~/.android && touch ~/.android/repositories.cfg

Also make sure that you are using Java 8 by calling java -version , otherwise sdkmanager won't work (as of time of writing).还要确保您通过调用java -version使用 Java 8,否则sdkmanager将无法工作(截至撰写本文时)。 Using Java 8 can be solved in many different ways, eg:使用 Java 8 可以通过许多不同的方式解决,例如:

  • Linux: sudo update-alternatives --config java Linux: sudo update-alternatives --config java
  • macOS using SDKMAN!: sdk use java <VERSION> macOS 使用 SDKMAN!: sdk use java <VERSION>
  • Other way另一种方式

Use采用

For help with all the commands run sdkmanager --help有关所有命令的帮助,请运行sdkmanager --help

For listing available components:列出可用组件:

sdkmanager --list

For installing a component:安装组件:

sdkmanager --install "build-tools;28.0.3"

For uninstalling a component:卸载组件:

sdkmanager --uninstall "build-tools;26.0.2"

Uninstalling Android SDK from Visual Studio Installer and then installing it again did resolve my problem and made the Android SDK options enable for me.从 Visual Studio 安装程序卸载 Android SDK,然后再次安装它确实解决了我的问题,并为我启用了 Android SDK 选项。

Goto VS Installer, go down to the SDK portion and uncheck Java SE Development Kit (version) and Android SDK setup (API level 25) from the individual component options and click on modify.转到 VS 安装程序,转到 SDK 部分并从各个组件选项中取消选中Java SE 开发工具包(版本)Android SDK 设置(API 级别 25) ,然后单击修改。

When they're gone, install them again following the same steps.当它们消失后,按照相同的步骤重新安装它们。

获取提示的图片

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

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