Quick Links

Clearing app cache and data can help keep your Android running smoothly, but digging through settings isn’t always fun. That’s where ADB (Android Debug Bridge) comes in—a faster, easier way to handle things from your computer.

What Is ADB and Why Use It?

ADB, or Android Debug Bridge, is a versatile tool that lets you communicate with and control Android devices from your computer. It’s a command-line utility that’s part of the Android SDK (Software Development Kit) and is widely used for tasks like troubleshooting, debugging, and even managing apps.

One of the key advantages of ADB is its ability to perform tasks much faster and more efficiently than using the phone’s interface. Whether you want to clear app cache, install APKs, or retrieve device logs, ADB gives you direct access to these functions with simple commands.

Remove Ads

ADB isn’t limited to physical devices—it also works seamlessly with virtual devices on Android emulators, making it a go-to tool for developers testing their apps in controlled environments. With the right setup, you can switch between physical and virtual devices effortlessly.

To use ADB, you’ll first need to install it. You can download the platform-tools package from the official Android developer site, which includes ADB. Once installed, enabling Developer Options on your Android device and turning on USB Debugging will allow ADB to connect to your device.

For added convenience, ADB now supports wireless connections. After setting up over USB, you can switch to wireless ADB, which lets you execute commands without needing a cable—perfect for when you’re on the go.

With its powerful capabilities and flexibility, ADB is a must-have tool for Android users and developers alike.

How To Clear Cache With ADB

Clearing an app’s cache using ADB is a practical way to troubleshoot issues or free up storage without navigating through your phone’s settings. Cache refers to temporary files stored by apps to improve performance, but over time, these files can accumulate and cause problems like app crashes or slowdowns. Clearing the cache can help resolve these issues without affecting your personal data.

Remove Ads

To begin, ensure ADB is installed and set up on your computer. Enable Developer Options and USB Debugging on your Android device, then connect it to your computer using a USB cable or wireless ADB. Confirm the connection by running the command on your command prompt or terminal:

adb devices

Before clearing cache or data, you’ll need the app’s package name. This might sound tricky, but it’s easy to find.

On the Command Prompt or Terminal, type this:

adb shell pm list packages

This will show a list of all the apps installed on your device.

Listing the installed apps in the device.

Look carefully for the one you want to manage. Package names usually follow a format like com.appname.android. If you’re unsure which app it is, the list will guide you.

Remove Ads

Once you’ve identified the package name, you’re ready to take action. For YouTube, the package name is com.google.android.youtube.

The process of clearing YouTube’s cache using ADB is straightforward but may require root access, especially on emulators or rooted devices. On your terminal or command prompt, run this command to enter the device’s shell environment:

adb shell

Once inside, you might need to switch to root mode, depending on your device’s setup. You can do this by typing su, which grants you elevated permissions. su means “switch user” and here, you will be switching to the root account. You will notice the prompt changes from a dollar sign ($) to a hash (#), indicating root access.

To clear the cache, execute this command:

rm -rf /data/data/com.google.android.youtube/cache/*

This removes all temporary files stored in the app’s cache directory, freeing up space and potentially resolving any issues caused by corrupted cache files.

Remove Ads
Clearing Youtube's cache with ADB.

How To Clear App Data With ADB

To clear an app’s data using ADB, the easiest and most direct method is by using the “pm clear” command. This command resets the app to its default state by clearing all data, including cache, preferences, and stored files.

To clear the app data of an application, use the command “adb shell pm clear <package_name>”, where <package_name> is the unique identifier for the app you want to reset.

To get a list of all the apps on the device, enter this command on your Command Prompt or Terminal:

adb shell pm list package

For example, to clear YouTube’s app data, type:

adb shell pm clear com.google.android.youtube
Clearing app data with ADB pm clear command.
Remove Ads

This will clear all stored data for YouTube, including login information, settings, and cache, essentially restoring the app as if it were freshly installed. This method is simple and works on both rooted and non-rooted devices.

If you’re working with a rooted device or emulator, you can also clear the app’s data manually. After entering the device’s shell with “adb shell”, you may need to switch to root access by typing “su” (you’ll notice the prompt changes from $ to #). Then, to clear the app’s data, use the comma

rm -rf /data/data/com.google.android.youtube/*
Clearing app data with adb shell.

This manually removes the app’s data, similar to the “pm clear” command, but with more control over which files are deleted. However, using “pm clear” is typically faster and safer for general app resets.

Remove Ads

Use ADB for Better App Management

Using ADB to clear cache and app data is a quick and effective way to manage your apps and optimize your device’s performance. Whether you use the “pm clear” command for a simple