[英]How to completely uninstall Android Studio on Mac?
I recently downloaded Android Studio on my Macbook Pro and I messed up with it every time I open it.我最近在我的 Macbook Pro 上下载了 Android Studio,每次打开它时我都搞砸了。 It gives me plugin errors and several other errors.它给了我插件错误和其他几个错误。 I need to uninstall it completely from my mac.我需要从我的 mac 上完全卸载它。 I tried to delete it from my mac and then install it again as if you would do the first time, but it did nothing and now the same problems occur.我试图从我的 mac 中删除它,然后像第一次安装一样再次安装它,但它什么也没做,现在又出现了同样的问题。
How can I manage to remove it completely and install a fresh one again?我怎样才能设法完全删除它并重新安装一个新的?
Execute these commands in the terminal (excluding the lines with hashtags - they're comments):在终端中执行这些命令(不包括带有主题标签的行——它们是注释):
# Deletes the Android Studio application
# Note that this may be different depending on what you named the application as, or whether you downloaded the preview version
rm -Rf /Applications/Android\ Studio.app
# Delete All Android Studio related preferences
# The asterisk here should target all folders/files beginning with the string before it
rm -Rf ~/Library/Preferences/AndroidStudio*
rm -Rf ~/Library/Preferences/Google/AndroidStudio*
# Deletes the Android Studio's plist file
rm -Rf ~/Library/Preferences/com.google.android.*
# Deletes the Android Emulator's plist file
rm -Rf ~/Library/Preferences/com.android.*
# Deletes mainly plugins (or at least according to what mine (Edric) contains)
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Application\ Support/Google/AndroidStudio*
# Deletes all logs that Android Studio outputs
rm -Rf ~/Library/Logs/AndroidStudio*
rm -Rf ~/Library/Logs/Google/AndroidStudio*
# Deletes Android Studio's caches
rm -Rf ~/Library/Caches/AndroidStudio*
rm -Rf ~/Library/Caches/Google/AndroidStudio*
# Deletes older versions of Android Studio
rm -Rf ~/.AndroidStudio*
If you would like to delete all projects :如果您想删除所有项目:
rm -Rf ~/AndroidStudioProjects
To remove gradle related files (caches & wrapper)删除 gradle 相关文件(缓存和包装器)
rm -Rf ~/.gradle
Use the below command to delete all Android Virtual Devices (AVDs) and keystores.使用以下命令删除所有Android 虚拟设备(AVD) 和密钥库。
Note : This folder is used by other Android IDEs as well, so if you still using other IDE you may not want to delete this folder)注意:这个文件夹也被其他 Android IDE 使用,所以如果你还在使用其他 IDE 你可能不想删除这个文件夹)
rm -Rf ~/.android
To delete Android SDK tools删除Android SDK工具
rm -Rf ~/Library/Android*
Emulator Console Auth Token模拟器控制台身份验证令牌
rm -Rf ~/.emulator_console_auth_token
Thanks to those who commented/improved on this answer!感谢那些对此答案发表评论/改进的人!
rm
are case-sensitive 1 (as with most other commands), which means that the f
flag must be in lower case. rm
的标志区分大小写1 (与大多数其他命令一样),这意味着f
标志必须为小写。 However, the r
flag can also be capitalised.但是, r
标志也可以大写。rm
can be either combined together or separated. rm
的标志可以组合在一起或分开。 They don't have to be combined.它们不必合并。r
flag indicates that the rm
command should- r
标志表示rm
命令应该 -
a ttempt to remove the file hierarchy rooted in each file argument.尝试删除以每个文件参数为根的文件层次结构。 - DESCRIPTION section on the manpage for
rm
(Seeman rm
for more info) -rm
联机帮助页上的描述部分(有关更多信息,请参见man rm
)
f
flag indicates that the rm
command should- f
标志表示rm
命令应该 -
a ttempt to remove the files without prompting for confirmation, regardless of the file's permissions.尝试在不提示确认的情况下删除文件,而不管文件的权限如何。 - DESCRIPTION section on the manpage for
rm
(Seeman rm
for more info) -rm
联机帮助页上的描述部分(有关更多信息,请参见man rm
)
Run the following commands in the terminal:在终端中运行以下命令:
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm -Rf ~/Library/Preferences/com.google.android.*
rm -Rf ~/Library/Preferences/com.android.*
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
rm -Rf ~/Library/Caches/AndroidStudio*
rm -Rf ~/.AndroidStudio*
rm -Rf ~/.gradle
rm -Rf ~/.android
rm -Rf ~/Library/Android*
rm -Rf /usr/local/var/lib/android-sdk/
To delete all projects:要删除所有项目:
rm -Rf ~/AndroidStudioProjects
For someone using Android Studio 4.0 or above on MacOS 10.15.1 or above.对于在 MacOS 10.15.1 或更高版本上使用 Android Studio 4.0 或更高版本的人。 Using command line blow:使用命令行打击:
# Deletes the Android Studio application
# Note that this may be different depending on what you named the application as, or whether you downloaded the preview version
rm -Rf /Applications/Android\ Studio.app
# Delete All Android Studio related preferences
# The asterisk here should target all folders/files beginning with the string before it
rm -Rf ~/Library/Preferences/Google/AndroidStudio*
# Deletes the Android Studio's plist file
rm -Rf ~/Library/Preferences/com.google.android.*
# Deletes the Android Emulator's plist file
rm -Rf ~/Library/Preferences/com.android.*
# Deletes mainly plugins (or at least according to what mine (Edric) contains)
rm -Rf ~/Library/Application\ Support/Google/AndroidStudio*
# Deletes all logs that Android Studio outputs
rm -Rf ~/Library/Logs/Google/AndroidStudio*
# Deletes Android Studio's caches
rm -Rf ~/Library/Caches/Google/AndroidStudio*
# Deletes older versions of Android Studio
rm -Rf ~/.AndroidStudio*
Difference区别
Library/Preferences/ Google /AndroidStudio*库/首选项/谷歌/AndroidStudio*
Library/Logs/ Google /AndroidStudio*图书馆/日志/谷歌/AndroidStudio*
Library/Caches/ Google /AndroidStudio*库/缓存/谷歌/AndroidStudio*
I was also facing same kind of problem on my Macbook Pro.我的 Macbook Pro 也遇到了同样的问题。 I took these very simple steps and freshly installed Android Studio.我采取了这些非常简单的步骤并全新安装了 Android Studio。
** Link Contains Images, look if facing any problem. **链接包含图像,如果遇到任何问题,请查看。
These Very Simple Steps Can Solve Your Problem.这些非常简单的步骤可以解决您的问题。
You may also delete gradle file, if you don't use gradle any where else:如果您不在其他任何地方使用 gradle,您也可以删除 gradle 文件:
rm -Rfv ~/.gradle/
because.gradle folder contains cached artifacts that are no longer needed.因为.gradle 文件夹包含不再需要的缓存工件。
Some of the files individually listed by Simon would also be found with something like the following command, but with some additional assurance about thoroughness, and without the recklessness of using rm -rf with wildcards: Simon单独列出的一些文件也可以通过类似以下命令找到,但对完整性有一些额外的保证,并且不会鲁莽地使用带通配符的 rm -rf:
find ~ \
-path ~/Library/Caches/Metadata/Safari -prune -o \
-iname \*android\*studio\* -print -prune
Also don't forget about the SDK, which is now separate from the application, and ~/.gradle/ (see vijay 's answer).也不要忘记现在与应用程序分开的 SDK 和 ~/.gradle/(请参阅vijay的回答)。
As we all know, we can't just drag and drop the Android Studio app to Trash.众所周知,我们不能只是将 Android Studio 应用程序拖放到垃圾箱。 The reason is that in this case, applications leave their service files on your Mac.原因是在这种情况下,应用程序会将其服务文件留在您的 Mac 上。 To uninstall Android Studio with all its service files at once, use the Terminal command line.要一次性卸载 Android Studio 及其所有服务文件,请使用终端命令行。
Follow the steps below:请按照以下步骤操作:
rm -Rf /Applications/Android\\ Studio.app rm -Rf /Applications/Android\\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio* rm -Rf ~/Library/Preferences/AndroidStudio*
rm -Rf ~/Library/Preferences/com.google.android.* rm -Rf ~/Library/Preferences/com.google.android.*
rm -Rf ~/Library/Preferences/com.android.* rm -Rf ~/Library/Preferences/com.android.*
rm -Rf ~/Library/Application\\ Support/AndroidStudio* rm -Rf ~/Library/Application\\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio* rm -Rf ~/Library/Logs/AndroidStudio*
rm -Rf ~/Library/Caches/AndroidStudio* rm -Rf ~/Library/Caches/AndroidStudio*
rm -Rf ~/.AndroidStudio* rm -Rf ~/.AndroidStudio*
rm -Rf ~/AndroidStudioProjects rm -Rf ~/AndroidStudioProjects
rm -Rf ~/.gradle rm -Rf ~/.gradle
rm -Rf ~/.android rm -Rf ~/.android
rm -Rf ~/Library/Android* rm -Rf ~/图书馆/Android*
This will delete all related files, including Android SDK.这将删除所有相关文件,包括 Android SDK。
I chanced upon one other directory which should be deleted (had a date of April 2021 on my system):我偶然发现了另一个应该删除的目录(我的系统上的日期是 2021 年 4 月):
rm -Rf ~/Library/Application\ Support/Android\ Open\ Source\ Project* rm -Rf ~/Library/Application\ Support/Android\ Open\ Source\ Project*
...and with credit to Hu1buerger of https://gist.github.com/talal/25d6b05b6969c2a8459b2b3abb86481f ...并归功于https://gist.github.com/talal/25d6b05b6969c2a8459b2b3abb86481f 的 Hu1buerger
rm -Rf ~/Library/Application\ Support/JetBrains* rm -Rf ~/Library/Application\ Support/JetBrains*
y
or n
终端要求确认删除y
或n
Note: Different terminal login launch command provide the ability to lookup and remove different files.注意:不同的终端登录启动命令提供查找和删除不同文件的能力。 So I executed both three following ways所以我执行了以下三种方式
find / -name "*android*" -ok rm -Rf {} \;
sudo find / -name "*android*" -ok rm -Rf {} \;
sudo su
find / -name "*android*" -ok rm -Rf {} \;
brew doctor
throw some warning just Install Homebrew again在此之后,如果您使用 Homebrew 和brew doctor
发出一些警告,只需再次安装 Homebrew/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.