I have an existing project in Android Studio that for example is
com.pete.mike.joe.appname. If I want to change it to com.pete.appname
how would I do that?
You can accomplish this by following the following 4 steps:
- You need to follow this answer till step 3.
- Then you need to drag and drop the
appname
directory to the pete
directory.
- After that Android Studio will prompt you to refactor the project. You should select
Move package 'com.pete.mike.joe.appname' to another package
. And confirm every prompt.
- Finally, hit
Do Refactor
to automatically refactor the project.
For your convenience, I have made a video example to show you how to change the package name and at the same time refactor the entire project in Android Studio. Please have a look at the following video,
video example