Reinstallation Android SDK is a task that every developer faces sooner or later. data-i="38">. Over time, SDKs clutter your disk with outdated versions, conflicting libraries, or corrupted files. This leads to build errors in Android. Over time, SDKs clutter your disk with outdated versions, conflicting libraries, or corrupted files. This results in build errors in Android Studio, problems with the emulator, or even the inability to run the project. But simply deleting the folder with the SDK and installing it again is not enough: residual files in the registry, cache and settings can preserve old problems.
In this guide we will cover full reinstallation cycle: from safely removing all components to setting up a fresh environment taking into account current requirements Google and JetBrains. We will pay special attention to typical errors (for example, Failed to install Android SDK or No platforms installed), ways to free up disk space and optimize the SDK to speed up work. Android Studio. If you encounter emulator freezes, Gradle version conflicts, or sudden build crashes, these instructions will help restore stability.
When you need to reinstall the Android SDK: 5 obvious signs
Do not rush to demolish the SDK at the first error - sometimes the problem is solved updating or clearing the cache. But there are symptoms that clearly indicate the need for a complete reinstallation:
- ๐ด Gradle synchronization errors with mention of missing packages (
Failed to resolve: com.android.tools.build:gradle:X.X.X), despite their presence in the repositories. - ๐ฅ๏ธ The emulator does not start or produces errors like
PANIC: Missing emulator engine app, even after re-creating the virtual device. - ๐ฆ Android Studio "does not see" installed platforms in
SDK Manager, although the files are physically present in the folder. - ๐ข Slowdown of the IDE to complete unusability: indexing projects takes hours, and code completion lags.
- ๐๏ธ Lack of disk space due to the bloated SDK folder (more than 20-30 GB), where most of it is occupied by unnecessary versions.
If at least two of these points are familiar - reinstalling the SDK is justified. However, before you start, check the alternative solutions:
What to try before reinstalling?
1. Update Android Studio to the latest version (menu Help โ Check for Updates).
2. Clear Gradle cache: delete folders .gradle in the user's home directory and build in the project, then do File โ Invalidate Caches / Restart.
3. Reset SDK Manager settings: close Android Studio, delete the file sdkmanager.bat (Windows) or sdkmanager (macOS/Linux) in folder tools/bin, then restart the IDE - it will restore the file automatically.
Critical error SDK location not found after updating Android Studio to version 2023.3+ is often associated with a change in the SDK folder structure. In this case, reinstallation is the only reliable way to restore functionality.
Preparing for reinstallation: backup and cleanup
Before removing the SDK be sure to save critical data. Even if you plan to install everything again, some files may be useful:
- ๐ Folder
~/.android(macOS/Linux) or%USERPROFILE%\.android(Windows) - containsdebug.keystore(APK debug signing key) and AVD files (emulator settings). - ๐ Keystore files for release builds (if you store them in the SDK folder). Losing the key means the inability to update applications in Google Play!
- โ๏ธ Custom emulator settings (for example, configurations for
x86_64with enabled Google Play Services).
For backup:
- Copy the folder
.androidto a safe place (for example, on an external drive). - Export the list of installed SDK packages with the command:
sdkmanager --list_installed > sdk_packages.txtThis will help you quickly restore the necessary components after reinstallation.
- If you use Android Emulator, save the images of virtual devices from the folder
~/.android/avd(they take up a lot of space, but you donโt need to copy them if you are ready to create new AVDs).
Copy the .android folder from debug.keystore|Export the list of SDK packages|Save keystore files for release builds|Write proxy settings (if you are using a corporate network)|Take screenshots of emulator configurations
-->
Now completely close:
- Android Studio (including background processes
java.exeorstudio64.exe). - All emulators (
emulator-arm,qemu-system). - Terminals with running commands
adborfastboot.
Use Process Explorer (Windows) or htop (macOS/Linux) to ensure that no processes are blocking SDK files. For example, adb.exe may remain in memory even after closing Android Studio.
Full removal of Android SDK: step-by-step guide
Removing an SDK is not just moving a folder to the trash. You need to clear all associated components, including cache, settings, and registry entries (for Windows). Follow the instructions for your OS:
๐ช Windows 10/11
- Delete the SDK folder:
By default, it is located in
C:\Users\\AppData\Local\Android\Sdk. If the path has been changed, check it in Android Studio:File โ Settings โ Appearance & Behavior โ System Settings โ Android SDK. - Clean the registry:
Click
Win + R, enterregeditand delete the branches:HKEY_CURRENT_USER\Software\Android StudioHKEY_LOCAL_MACHINE\SOFTWARE\Android SDK Toolsโ ๏ธ Attention: Incorrectly editing the registry can disrupt the system. Before making changes, create a restore point (
Control Panel โ Recovery โ System Restore setup). - Delete environment variables:
Open
Control Panel โ System โ Advanced system settings โ Environment variablesand delete the paths containingAndroidorSdk.
๐ macOS
- Delete the SDK folder (usually
/Users//Library/Android/sdk). - Clear the cache:
rm -rf ~/Library/Caches/Android*rm -rf ~/Library/Logs/AndroidStudio* - Delete symbolic links (if created):
ls -l ~/ | grep AndroidDelete found links with command
unlink.
๐ง Linux (Ubuntu/Debian)
- Delete the SDK folder (usually
/home//Android/Sdk). - Remove packages installed through
apt:sudo apt remove --purge android-sdk android-sdk-platform-tools - Clean configuration files:
rm -rf ~/.local/share/Android*rm -rf ~/.config/Android*
After deletion Reboot the computer. This ensures that all temporary files and locks will be reset.
Manually deleting the folder|Via Android Studio uninstaller|Script/command|Never deleted
-->
Installing a fresh Android SDK: optimal configuration
Now let's proceed with a clean installation. We will consider two methods: through Android Studio (recommended for beginners) and manually through sdkmanager (for experienced users).
Method 1: Installation via Android Studio
- Download the latest version Android Studio from of the official website (at the time of writing this article, the current version is Giraffe 2022.3.1 or later).
- When you first start, select
Do not import settings(do not import settings) to avoid conflicts with old configurations. - In the installation wizard, specify new path for the SDK (for example,
D:\Android\Sdkon Windows or/opt/android/sdkon Linux). This will help avoid problems with access rights. - Wait for the basic components to load (Android SDK Platform-Tools, Android Emulator, Build-Tools).
Method 2: Manual installation via sdkmanager
This method gives more control over versions and allows you to install only the necessary ones packages.
- Download SDK command tools (Command line tools only) from downloads page.
- Extract the archive to a folder of your choice (for example,
C:\Android\cmdline-tools). - Add the paths to
platform-toolsandtools/binto the environment variablePATH. - Install the necessary packages. Example for a minimal configuration:
sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.0" "emulator"
The optimal set of packages for most projects:
| Component | Version (recommended) | Purpose |
|---|---|---|
platform-tools |
Last | ADB, Fastboot and other utilities |
platforms;android-33 |
Android 13 (API 33) | Basic platform for assembly |
build-tools;33.0.0 |
33.0.0 | Compilation of resources and dex files |
emulator |
Last | Android device emulator |
patcher;v4 |
Last | For working with Dynamic Features |
After installation check performance:
- Run
adb --versionin the terminal - the version should be displayed ADB. - Create a new project in Android Studio and try to build it (
Build โ Make Project).
Install only those versions of platforms (platforms;android-X), which are really needed for your projects. Each additional version takes up 1-2 GB of space and increases the Gradle synchronization time.
SDK optimization: how to save space and speed up work
Default Android SDK can take up tens of gigabytes, especially if you install all available packages We optimize. configuration:
1. Removing unnecessary components
Open SDK Manager in Android Studio i:
- ๐๏ธ Remove outdated versions
build-tools(leave only the last one and the one that is used in projects). - ๐ฑ Delete system images for the emulator (
system-images), except those you use (for example,android-33;google_apis;x86_64). - ๐ง Delete
sourcesanddocsfor platforms, if you do not use local documentation.
2. Setting up the Gradle cache
Add to the file gradle.properties of your project:
org.gradle.caching=trueandroid.enableBuildCache=true
android.buildCacheDir=../.buildcache # Cache folder outside the project
This will speed up rebuilds and reduce disk space usage.
3. Using lightweight emulators
Instead of a standard emulator Android consider alternatives:
- ๐ Genymotion - faster and more stable, but requires registration.
- ๐ฑ BlueStacks (developer mode) - suitable for testing in a real environment.
- ๐ฅ๏ธ Physical device is the most reliable option (enable
USB Debuggingin the developer settings).
Example configuration for an emulator with minimal resource consumption:
- ๐ฑ Device:
Pixel 5(resolution1080ร2280). - ๐ฅ๏ธ Processor:
x86_64(notARM!). - ๐พ RAM: 1536 MB (enough for most applications).
- ๐ฟ Virtual disk: 512 MB (instead of the standard 2 GB).
To speed up the emulator on Windows, enable Hyper-V in the BIOS settings. On macOS, use the emulator based on WHXP in BIOS settings. On macOS, use an emulator based on Apple Silicon (if you have M1/M2), it works in 2-3 times faster than on Intel.
Solving common errors after reinstalling the SDK
Even after a clean installation, problems can arise and how to fix them:
Error: Failed to install Android SDK
Cause: Corrupted. download files or blocking by an antivirus.
Solution:
- Disable the antivirus (Avast, Kaspersky often blocked
sdkmanager). - Delete the folder
~/.android/cacheand repeat the installation. - If a proxy is used, configure it in Android Studio:
File โ Settings โ Appearance & Behavior โ System Settings โ HTTP Proxy.
2. The emulator does not start (PANIC: Cannot find AVD system path)
Cause: Incorrect path to system images or lack of rights.
Solution:
- Check that the system image is installed:
sdkmanager --list | grep "system-images" - Make sure that the path to the SDK is in Android Studio matches the real one (
File โ Project Structure โ SDK Location). - On Linux/macOS, run:
chmod -R 755 ~/Library/Android/sdk
3. Gradle does not find dependencies (Could not resolve...)
Cause: Incompatibility of versions gradle-plugin and build-tools, or problems with repositories.
Solution:
- Update
gradle-wrapperin the project:./gradlew wrapper --gradle-version 8.0 --distribution-type bin - Add Google Maven Repository to
build.gradle:allprojects {repositories {
google()
mavenCentral()
}
} - Clear the Gradle cache:
rm -rf ~/.gradle/caches/
โ ๏ธ Attention: If you are using a corporate proxy, some dependencies (for example,com.android.tools.build:gradle) may be blocked. Check the proxy settings ingradle.properties:systemProp.http.proxyHost=proxy.example.com
systemProp.http.proxyPort=8080
Automating SDK reinstallation: scripts and tools
If you often have to reinstall the SDK (for example, on CI servers or when setting up new machines), automate the process using scripts.
Script for Windows (PowerShell)
Save as reset-android-sdk.ps1 and run as administrator:
# Removing the old SDKRemove-Item -Recurse -Force "$env:LOCALAPPDATA\Android\Sdk"
Remove-Item -Recurse -Force "$env:USERPROFILE\.android"
Remove-Item -Recurse -Force "$env:USERPROFILE\.gradle"
Installing a new SDK
$SdkToolsUrl = "https://dl.google.com/android/repository/commandlinetools-win-9477386_latest.zip"
$OutputPath = "$env:USERPROFILE\Downloads\sdk-tools.zip"
Invoke-WebRequest -Uri $SdkToolsUrl -OutFile $OutputPath
Expand-Archive -Path $OutputPath -DestinationPath "C:\Android\cmdline-tools"
Remove-Item -Force $OutputPath
Setting environment variables
[Environment]::SetEnvironmentVariable("ANDROID_HOME", "C:\Android\Sdk", "Machine")
$PathVar = [Environment]::GetEnvironmentVariable("Path", "Machine")
[Environment]::SetEnvironmentVariable("Path", "$PathVar;C:\Android\Sdk\platform-tools;C:\Android\Sdk\tools\bin", "Machine")
Write-Host "The SDK has been removed and is ready for a new installation. Restart your computer."
Script for macOS/Linux (Bash)
Save as reset-android-sdk.sh and make executable (chmod +x):
#!/bin/bashRemoving the old SDK
rm -rf ~/Android/Sdk
rm -rf ~/.android
rm -rf ~/.gradle
Installing command tools
SDK_TOOLS_URL="https://dl.google.com/android/repository/commandlinetools-$(uname | tr '[:upper:]' '[:lower:]')-9477386_latest.zip"
INSTALL_DIR="$HOME/Android/cmdline-tools"
mkdir -p "$INSTALL_DIR"
curl -L "$SDK_TOOLS_URL" -o "/tmp/sdk-tools.zip"
unzip "/tmp/sdk-tools.zip" -d "$INSTALL_DIR"
rm "/tmp/sdk-tools.zip"
Setting PATH
echo 'export ANDROID_HOME=$HOME/Android/Sdk' >> ~/.bashrc
echo 'export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin' >> ~/.bashrc
source ~/.bashrc
echo "SDK has been deleted. Install packages via sdkmanager after reboot."
To automatically install packages, add to the end of the script:
yes | sdkmanager --licenses
sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.0" "emulator"
Use scripts carefully - they delete all SDK data without the possibility of recovery. Before starting, make sure. that backups have been made and the paths in the script correspond to your system.
FAQ: Frequently asked questions about reinstalling the Android SDK
๐น Is it possible to reinstall the SDK without uninstalling Android Studio?
Yes, Android Studio and SDK are independent components. You can delete the SDK folder and specify a new path in the IDE settings: File โ Settings โ Appearance & Behavior โ System Settings โ Android SDK. However, if the problems are related to Android Studio (for example, constant crashes), it makes sense to reinstall it too.
๐น How to transfer the SDK to another drive without reinstalling?
1. Close Android Studio and all related processes.
2. Copy the SDK folder to a new drive (for example, D:\Android\Sdk).
3. Update the environment variables (ANDROID_HOME and PATH).
4. Android Studio specify the new path to the SDK.
5. Check functionality command adb version.
โ ๏ธ Attention: If you use symbolic links (for example, on Linux), make sure that they point correctly to the new location. Check with the command ls -l ~/Android/Sdk.
๐น Why does it take a long time for Gradle to sync after reinstalling the SDK?
This is related. with:
- ๐ฅ Downloading dependencies again (Gradle cache was cleared).
- ๐ Updating repository indexes (especially if the project has not been updated for a long time).
- ๐ก Slow Internet connection or blocking proxy.
To speed up the process:
- Use offline mode after the first successful synchronization (
File โ Settings โ Build, Execution, Deployment โ Gradle โ Offline work). - Set up a repository mirror (for example, Aliyun for users from China).
- Increase heap memory for Gradle by adding to
gradle.properties:org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m
๐น Is it possible to use several versions of the SDK at the same time?
Technically yes, but it requires manual configuration. For example:
- Install a second copy of the SDK in a different folder (for example,
C:\Android\Sdk_Old). - In the project, specify the desired version in
local.properties:sdk.dir=C:/Android/Sdk_Old - Use
sdkmanagerwith the flag--sdk_rootto manage packages in a specific folder SDK.
However, this may lead to version conflicts build-tools or platform-tools, so it is recommended to use one current version of the SDK.
๐น How to restore SDK licenses after reinstallation?
Licenses The SDKs are stored in the folder ~/.android (or %USERPROFILE%\.android on Windows). If you made a backup copy of this folder, just return it to its place. If not, accept the licenses again:
- Open a terminal and run:
yes | sdkmanager --licensesThis will automatically accept all licenses.
- For a specific license (for example,
android-sdk-license) use:sdkmanager --licenses | grep "android-sdk-license"echo "24333f8a63b6825ea9c5514f83c2829b804d18ce" | sdkmanager --license(replace the hash with the current one from the output of the first command).