How to remove packages in Android Studio

Android Studio is an official IDEIntegrated Development Environment for developing android apps and is based on IntelliJ IDEA. This IDE makes life easier when developing android apps through its multiple features. In this answer, we'll learn how to remove packages in Android Studio.

The idea is to move all classes and packages to our desired package and then delete the empty package.

Let us take a look at an example to understand this better.

Example

Let's say we have an android project that looks like this. If packages are in compact, we can expand them by clicking the gear icon at the top right of the image and unchecking the "Compact Empty Middle Packages" option.

Compact view of packages in  android studio project
Compact view of packages in android studio project

Once we uncheck the option, our packages will be expanded as shown below. Here, we're going to remove "my" package. So drag and drop the "application" package and its "classes" to the "example" package.

Expanded view of packages in  android studio project
Expanded view of packages in android studio project

Android Studio will then ask for our confirmation to move everything as shown below. Simply click "OK" and then "YES".

Confirmation dialog images that are shown while moving the package
Confirmation dialog images that are shown while moving the package

As the final step, it will show a dialog to confirm refactoring. Click "REFACTOR".

Confirmation dialog to refactor
Confirmation dialog to refactor

Android Studio will take between a few seconds to minutes to refactor everything based on the size of our project. Once done, our packages will be moved to the "example" package and "my" package will be empty.

Project view after moving application package to example package
Project view after moving application package to example package

Now, we can delete "my" package by selecting it and clicking the "Delete" button on the keyboard.

Project view after removing the package my.
Project view after removing the package my.

And we're done! We have deleted "my" package from the Android Studio project successfully.

Note: Let's say we deleted the "application" package and not "my" package. Then we'd need to change the package name in AndroidManifest.xml and build.gradle files after moving all the classes.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved