Here step rename package project In Android Studio, in example
from : com.old.app.package
to : com.new.app.package
Make sure there’s no app use same package by checking here https://play.google.com/store/apps/details?id=[your new package] like this : https://play.google.com/store/apps/details?id=com.new.app.package
If your purpose renaming package is for google play upload, on Android Studio you only need to change applicationId at app/build.gradle
Then you no need to do instruction below because some case face error,
- Create new package in java directory, e.g. com.new.app.package. Right click on app/src/main/java directory -> New -> Package.
- Select all packages and classes in com.old.app.package and move (drag) them to the new package. Confirm by click on Do Refactor.
- Delete the old package com.old.app.package.
- Open app/src/main/AndroidManifest.xml and rename the package name. Select package name com.old.app.package -> Right click on selected text -> Refactor -> Rename -> enter the new package name (com.new.app.package), select “Search in comments and strings” option -> Refactor -> Do Refactor.
- Clean the project. Main menu -> Build -> Clean Project.
- Replace all occurrences of com.old.app.package for a new package name, e.g. com.new.app.package. Right click on app directory -> Replace in Path -> set old and new package names, Case sensitive to true -> Find -> Replace.
- Clean the project again. Main menu -> Build -> Clean Project.
- Synchronize the project. Main menu -> Tools -> Android -> Sync Project with Gradle Files.
- If you appear Activity class does not exist error restart Android Studio.