How To Create/Add New Package Inside Src Folder In Android Studio

Sometimes we need to separate our java classes according to their functionality. Keeping various java classes in different package name make the project more understandable for anyone.


How to Create/Add new Package inside src folder in Android Studio

The following are the steps to add new Package name inside src folder:

Step 1: Open Android Studio and Navigate to any view(Android or Project)

Step 2: In Android View you will have two folders: app and Gradle Scripts

Step 3: Open App folder then open Java folder. Right click on Java folder and select New > Package.

creating new package in Android Studio

Step 4: Choose directory destination which main\java and click OK.

Choose Directory destination for New Package Android Studio

Step 5:  Give a name to new Package(For example: samplePackage). Click Ok.

new package name Android Studio

Step 5: Now you have samplePackage inside JAVA folder. You can keep separate Java files inside it.

new package created in JAVA Android Studio

DOWNLOAD THIS FREE eBook!

This free eBook will help you master the learning of Android App Development in Android Studio!

5 thoughts on “How To Create/Add New Package Inside Src Folder In Android Studio”

  1. when I create a package inside the package it will combine with the first one. At first, I created a package name model then I create another package inside model I,e datamodel it will create like model.datamodel .How I can fix it?

  2. In above tutorial u showed how to create the package in src directory.but how to import the same package in any other java file