Android Studio: create another activity (package name is not set to a valid package name)

441 Views Asked by At

My android application has a package spectorsky placed directly in java1 catalog. Incide this package, there is launched activity MainActivity, and I need to create additional activity in the same package.

However when I call New activity dialog and type spectorky as a package name, error package name is not set to a valid package name appears.

Dialog suggests com.tmp.spectorsky.calendar as a package name (calendar is a name of the app), but this creates some directories and places new activity in a new created package.

Dialog for creating empty activity

So, the question: how to create new activity in the same package?

Thanks for any idea

1

There are 1 best solutions below

1
Partha Hudati On

Your activity package name should start with your project package name. your activity package must present in your project package. Like this 1st change your view from project to android change your view from project to android if you want to create your own package then right-click on the 1st package name then choose to create the package. After that right-click on your package name then create activity.