6

As you know, app package name (**com.****.******) is very important thing in Flutter app, it is also being used in app's link on Play Store, and some other places.

So, I have a app package name which is automatically created by flutter when creating app via command line: com.example.app

How can I change it properly? There are lots of files and folders named after the app package name, so changing app package name manually without causing error is something I seek.

5 Answers 5

14

You need to change it in

  • android/app/build.gradle
  • android/app/src/main/kotlin/com/example/personal_web/MainActivity.kt
  • android/app/src/main/AndroidManifest.xml
Sign up to request clarification or add additional context in comments.

1 Comment

also on android/app/src/main/profile/AndroidManifest.xml
5

There's a useful package for changing it but it works well with android, I didn't try for IOS.

Firstly install the package:

  change_app_package_name: ^1.0.0

Then in terminal in your project paths do these commands:

flutter pub get

Then write the line below and use the unique name you want after com. then press enter:

flutter pub run change_app_package_name:main com.myuniquename.flutter_app

it will update files and delete old package name.

Comments

4

You need to change it in the following files.

  • android/app/build.gradle
  • android/app/src/main/kotlin/com/example/personal_web/MainActivity.kt
  • android/app/src/main/AndroidManifest.xml
  • android/app/src/main/profile/AndroidManifest.xml
  • android/app/src/debug/AndroidManifest.xml

Comments

2

The most appropriate command would be flutter create --org com.changehere -a kotlin -i swift yourapp_name

1 Comment

This command can be used when creating a new project, but cannot modify an existing project identifier. But still valid solution 1- create new project with this command then transfer lib and other files to new package.
1

From the documentation:

Your application ID is defined with the applicationId property in your module's build.gradle file [...]

Flutter: Open /android/app/build.gradle, scroll down to applicationId.

2 Comments

so, you're saying no need change anything else?
I would be surprised, if you really need to change each file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.