Open In App
Related Articles

How to Create New Package Inside Src Folder in Android Studio?

Improve Article
Save Article
Like Article

A package is a namespace that combines a set of relevant classes and interfaces. Conceptually one can consider packages as being similar to various folders on your computer. One might have HTML pages in one folder, images in another, and scripts or applications in yet another. Because in android, software written in the Java/Kotlin programming language can be made of hundreds or thousands of different classes, it makes sense to keep things organized by placing related classes and interfaces into packages. A package is basically the directory (folder) in which the source code resides. Normally, this is a directory structure that uniquely distinguishes the android application; such as Then the developer can build packages within the application package that divides the code; such as or The package for each android application resides within the src/main/java directory of the application module. The developer could put a different package within the application package to separate each “layer” of the application architecture. 

During android app development sometimes the developers need to separate the Java/Kotlin classes according to their functionality. Having various java classes in different package name make the project more understandable for anyone. So in this article, we are going to discuss how could a developer create a new package inside the Src folder in Android Studio.

Step by Step Implementation

Step 1: To create a new package inside the Src folder in Android studio open your project in Android mode first as shown in the below image. 

Step 2: Now go to the java > right-click > New > Package as shown in the below image.

Step 3: Then a pop-up screen will arise like below and here select the main\java and click on OK.

Step 4: On the next screen write down your new package name. Here I have given my new package name GeeksforGeeks. And you are done.

Now go to the app > java > GeeksforGeeks and you can find your new package as shown in the below image. You can keep separate Java or Kotlin files inside it. 

Last Updated : 18 Feb, 2021
Like Article
Save Article
Similar Reads