Optimize imports in Android applications

Working on Android applications mean a lot of files and lots of imports in each package. These imports can be cleaned up easily if you have Android Studio installed. Read on how to optimize imports in your Android applications the easy way.

Before you click that optimize link in Android Studio, you maybe wondering but why you need it at all?

To understand it check the image below. Here Assert.* will import all the packages inside Assert and that means extra and unwanted packages which your app does not need.

imports-example

To optimize imports in your Android project, in Android Studio right click on the project(app in most cases) and click Optimize Imports. Click Run to continue.

optimize-imports-in-android-studio

Leave a Reply

Your email address will not be published.