Steps to Change Package Name in Android Studio Project
Posted 2025-02-24 19:09:26
0
358

Changing the package name in an Android Studio project involves several steps. Follow this guide carefully to ensure everything updates correctly.
Step 1: Open Project in Android Studio
- Launch Android Studio and open your project.
Step 2: Change Package Name in AndroidManifest.xml
-
Open
AndroidManifest.xml
(found inapp/src/main/AndroidManifest.xml
). -
Locate the
package
attribute at the top. -
Change it to your desired package name.
Example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.newpackage.name">
Step 3: Change Package Name in the Java/Kotlin Folder
- In the Project view, switch to Android mode.
- Expand
app > java
. - Right-click your existing package name and select Refactor > Rename.
- Choose Rename Package.
- Enter the new package name and click Refactor.
- Android Studio will update occurrences of the package name in your code.
- Click Do Refactor to confirm.
Step 4: Update build.gradle (Module: app)
-
Open
app/build.gradle
. -
Locate
applicationId
insidedefaultConfig
. -
Update it to the new package name.
Example:
defaultConfig { applicationId "com.newpackage.name" }
-
Click Sync Now when prompted.
Step 5: Update google-services.json
(if using Firebase)
- If your project is connected to Firebase, download a new
google-services.json
file with the updated package name from the Firebase Console. - Replace the old
google-services.json
file inapp/
.
Step 6: Clean and Rebuild the Project
- Go to Build > Clean Project.
- Then go to Build > Rebuild Project.
Step 7: Invalidate Cache and Restart
- Click File > Invalidate Caches / Restart.
- Choose Invalidate and Restart.
Verifying the Changes
- Run the app to ensure it works correctly.
- If you encounter errors, check the log and update any missed occurrences of the old package name.
Search
Sellect from all Categories bellow ⇓
- Artificial Intelligence (AI)
- Cybersecurity
- Blockchain & Cryptocurrencies
- Internet of Things
- Cloud Computing
- Big Data & Analytics
- Virtual Reality
- 5G & Future Connectivity
- Robotics & Automation
- Software Development & Programming
- Tech Hardware & Devices
- Tech in Healthcare
- Tech in Business
- Gaming Technologies
- Tech in Education
- Machine Learning (ML)
- Blogging
- Affiliate Marketing
- Make Money
- Digital Marketing
- Product Review
- Social Media
- Excel
- Graphics design
- Freelancing/Consulting
- FinTech (Financial Technology)
- E-commerce and Digital Marketing
- Business
- Sport
- Self Development
- Tips to Success
- Video Editing
- Photo Editing
- Website Promotion
- YouTube
- Lifestyle
- Health
- Computer
- Phone
- Music
- Accounting
- Causes
- Networking
Read More
Introduction to HTML
1. Description of HTML
HTML (HyperText Markup...
Steps on Becoming a tech professional
Becoming a tech professional is an exciting...
How to Create a WordPress Website: A Step-by-Step Guide
Creating a WordPress website is a...
The Basics of Python to get started
Basics of Python
1. Introduction to Python...
Introduction to Computer Science
Computer Science is a vast and dynamic field...