In android, every app has a unique id. The unique id is very important for identifying the particular app. The id looks like a java package name. You can use your domain name as a package dame. Because the domain name is unique.
Changing the package name in flutter is very easy. Follow the simple steps,
Table of Contents
Step 1: Changing Package name in AndroidManifest.xml file (main)
First, go to the android>app> src>main > AndroidManifest.xml
file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.name">
Find the package name in the first line, then change the package name as per your need.
Step 2: Changing Package name in AndroidManifest.xml file (debug)
Then, go to the android>app> src>debug> AndroidManifest.xml
file.
Find the package name and change it.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.name">
Step 3: Changing Package name in AndroidManifest.xml file (profile)
Then, go to the android>app> src>debug> AndroidManifest.xml
file.
Find the package name and change it.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.name">
Step 4: Changing Package name in build.gradle (App level)
Then, go to the android>app> build.gradle
file and change the package name.
defaultConfig {
applicationId "com.example.name"
minSdkVersion 16
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Step 5: Change the package name in MainActivity.kt
Then, go to the android> app> src> main> kotlin> MainActivity.kt and change the package name.
package com.example.name
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
Step 6: Changing directory name
Then change the directory name from android\app\src\main\kotlin\com\example\name
to android\app\src\main\kotlin\your\package\name
.
This is the complete process of changing the package name in the entire flutter app. To avoid renaming use flutter create --org com.yourdomain appname
command.
Also Read,
- How to remove debug banner in flutter?
- Create Rounded Button in Flutter
- Create Onboarding screen only one time.
- Create Splash Screen in flutter.
Leave a Review