Change Android Package Name¶
This guide explains how to change the Android package name for your existing Flutter project, SaleBot Chat.
Prerequisites¶
- Flutter SDK installed
- An existing Flutter project (SaleBot Chat) set up
- Basic understanding of Flutter and Android app structure
Steps to Change Android Package Name¶
1. Open Your Flutter Project¶
Open your Flutter project in your preferred IDE (VS Code, Android Studio, etc.).
2. Change the Package Name in Android Files¶
- Update
android/app/src/main/AndroidManifest.xml
In the AndroidManifest.xml
file, change the package
attribute to your desired package name. You will find it in the <manifest>
tag at the top of the file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.newname.saleBotChat">
...
</manifest>
- Update
android/app/build.gradle
In the build.gradle
file under android/app/
, change the applicationId
to match your new package name:
android {
...
defaultConfig {
applicationId "com.newname.saleBotChat" // Update this to new package name
...
}
}
-
Rename the Package Folder in Android Directory
-
Navigate to
android/app/src/main/java/com/oldname/
in your project directory. - Rename the folder
com/oldname/
to match the new package structure, e.g.,com/newname/
. - Update any internal references within files under
src/main/java/
.
3. Update Package References in Code¶
In all .dart
and .java
files where the old package name is referenced (usually for integration purposes), update the references to the new package name.
4. Clean the Flutter Project¶
After updating the package name, run the following command in your terminal to clean the project: ```bash flutter clean