⏱️ Reading Time: 1 minute | 📝 Word Count: 157
Changing Package Name in Android Studio
There are 2 steps to properly change the package name:
Step 1: Refactor the Package Name
- In the Project panel, switch view to Android
- Expand
app → java - Right-click on your package name (e.g.,
com.example.myapp) - Select Refactor → Rename
- A dialog will appear — click “Rename Package”
- Type your new package name
- Click Refactor and then Do Refactor
Step 2: Update in AndroidManifest.xml
- Go to
app → manifests → AndroidManifest.xml - Find and update the
packageattribute:
<manifest xmlns:android="..."
package="com.newname.myapp">
- Save the file
Step 3: Update in build.gradle
- Go to
app → build.gradle - Find
applicationIdand update it:
android {
defaultConfig {
applicationId "com.newname.myapp"
...
}
}
- Click “Sync Now” when prompted
Step 4: Clean & Rebuild
Go to Build → Clean Project, then Build → Rebuild Project
⚠️ Important: Make sure all three places match exactly:
- Folder package name
AndroidManifest.xmlbuild.gradle (applicationId)
If they don’t match, the app will throw build errors.