Simple steps to rename your app

Simple steps to rename your app

Well, when you start developing an app, you might not think about choosing the proper name (or is it just my issue?). Anyway, perhaps some of you will find this article useful.

Imagine we have iOS and Android apps developed with Flutter, and we've named our app 'Example.' Such a nice name, right? Just before the release, you come up with a mind-blowing app name, which I believe is one of the keys to success for your application. So, let's start cleaning up our mess. There are two ways to do this. First, I'll explain the longer method. Which is rename everything manually

Flutter project

Here everything starts with your pubspec.yaml file

pubspec.yaml

Okay here we have to rename name tag to your nice app name. After you rename - most likely you'll have a compile error, because all internal imports in your project will become invalid:

invalid imports

This one you can fix manually.

Next step would be to change launch.json file for bigger convenience, so you can see you build variants correctly.

launch.json


Android project

In Android project you have to add changes in these files

Android project


Additionally you need change the folders names inside main folder + package name in MainActivity class

MainActivity

Inside build.gradle file you need to change namespace and applicationId

namespace


applicationId

In AndroidManifest.xml you would need to change label parameter.

And I believe this is it for Android. Now it's ios turn

iOS project

In ios everything is simple and straightforward as well. You have to open your iOS project using XCode. In case if you've never done this before, just open your Runner.xcworkspace (not xcodeproj) which is located in iOS folder.

In "General" tab you have to update identity, with your appname and bundle identifier.

General/identity

And of course you would need to change Signing and Capabilities in the similar way.

Signing and Capabilities

Important that I have to create Bundle Identifier on your Appstore connect, to be able to release on Testflight and Appstore.

And finally inside file Info.plist which is located here ios/Runner/Info.plist you would also need to update CFBundleDispayName and CFBundleName. This step you can complete in your VSCode/Android Studio/Intelij Idea.

Info.plist

And this is it :) As a conclusion I would like to provide you a check list for your actions.

In VSCode/Android Studio/Intelij Idea I need:

  • Update pubspec.yaml (name)
  • Update imports in dart files
  • Change launch.json (name inside each configuration)
  • Android: Change Folder names
  • Android: Update MainActivity package name
  • Android: Change application build.gradle (applicationId inside default config, namespace inside android block)
  • Android: Inside AndroidManifest change the label
  • iOS: Update Info.plist parameters (CFBundleDispayName and CFBundleName)

In XCode:

  • iOS: In General tab change the identity
  • iOS: In Signing and Capabilities change Bundle Identifier

There is also another way. In XCode you can use Cmd + Shift + H (Find and Replace) and replace your test appname with real appname. This approach can bring some compile errors and I believe it's not a time saver. But you have to decide.

Happy coding! :)

要查看或添加评论,请登录

社区洞察

其他会员也浏览了