close

How to change package name in flutter?

There are 6 primary strides to take to effectively change the bundle name for your ripple application.

Image for post
Modify the applicationId in your build.gradle file

These means must be followed carefully to forestall any possible accident.

  1. Adjust the bundle name in your MainActivity.java record

Adjust bundle com.example.app; to mirror your new bundle name:

<project-name>/android/app/src/main/java/com/example/app
package com.example.app;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
  1. Change the catalog containing your MainActivity.java document

Change the catalog structure from:

<project-name>/android/app/src/main/java/com/example/app

to:

<project-name>/android/app/src/main/java/your/package/name
  1. Adjust the bundle name in your primary AndroidManifest.xml record

Supplant “com.example.app” with your new bundle name:

<project-name>/android/app/src/main
<manifest xmlns:android=”http://schemas.android.com/apk/res/android" package=”com.example.app”>
  1. Alter the bundle name in your investigate AndroidManifest.xml record

Do likewise here:

<project-name>/android/app/src/debug
<manifest xmlns:android=”http://schemas.android.com/apk/res/android" package=”com.example.app”>
  1. Adjust the bundle name in your profile AndroidManifest.xml record

Also, here:

<project-name>/android/app/src/profile
<manifest xmlns:android=”http://schemas.android.com/apk/res/android" package=”com.example.app”>
  1. Alter the applicationId in your build.gradle record

Adjust the applicationId to mirror your new bundle name:

<project-name>/android/app/src/profile
defaultConfig {
  // TODO: Specify your own unique Application ID     (https://developer.android.com/studio/build/application-id.html).
  applicationId "com.example.app"
  minSdkVersion 18
  targetSdkVersion 28
  versionCode flutterVersionCode.toInteger()
  versionName flutterVersionName
  testInstrumentationRunner   "android.support.test.runner.AndroidJUnitRunner"
}

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment