Skip to content

Create a Package

Patryk Michalik edited this page Apr 11, 2022 · 2 revisions

The package name is an internal namespace for your code like com.example.app. This is used to resolve relative class names, among other things. It isn’t shown to users.

Add a Package

Right-click on /app/src/main/kotlin and select NewPackage. Name and create your package:

  • Segments are separated with full stops.
  • In segments, only alphanumeric characters and underscores are allowed.

Segments are translated to directories, so com.example.app becomes .../com/example/app in the file tree.

Move Files to the Package

Expand /app/src/main/kotlin/dev/jahir/blueprint/app (that’s dev.jahir.blueprint.app—the default package) and cut all four files located inside. Paste these in your package and delete the default package directory.

Connect the Package

/app/src/main/AndroidManifest.xml contains a package attribute:

package="dev.jahir.blueprint.app">

Edit this so it matches your package name.

Note
In case of issues, select FileInvalidate Caches, check Clear file system cache and local history, and click Invalidate and Restart.

Clone this wiki locally