Android tutorial - How to Change Package Name in Android Studio - android studio tutorial

What is package?

  • Package objects contain version information about the implementation and specification of a Java package.
  • This versioning information is retrieved and made available by the Class Loader instance that loaded the class(es).
  • Typically, it is stored in the manifest that is distributed with the classes.
  • The set of classes that make up the package may implement a particular specification and if so the specification title, version number, and vendor strings identify that specification.
  • 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.

What is Src folder?

  • "Src" is the folder where the project's source files are located.
  • For example, if you are working on a Java project, and its sub folders would hold the .java files.
  • "Bin" folder is usually where the compiled files are copied to.

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.
 packages creation in android
 directory destination for packages in android
  • Step 5: Give a name to new Package (For example: samplePackage).
  • Click Ok.
 packages creation in android
  • Step 6: Now you have samplePackage inside JAVA folder.
  • You can keep separate Java files inside it.
 packages creation in java android studio

Related Searches to How to Change Package Name in Android Studio