Procedure for Renaming AppName and Package Name
Example (Current Attributes):
Project Name: projectname
Android: Package Name e.g. com.geekdish.projectname
iOS: Bundle ID e.g com.geekdish.projectname
Step 1: Activate the rename package
From Android Studio, open Terminal and execute the following
> flutter pub global activate rename
Resolving dependencies...
+ args 2.3.0
+ logger 1.1.0
+ rename 1.3.1
Downloading rename 1.3.1...
Downloading logger 1.1.0...
Building package executables...
Built rename:rename.
Installed executable rename.
Warning: Pub installs executables into $HOME/.pub-cache/bin, which is not on your path.
You can fix that by adding this to your shell's config file (.bashrc, .bash_profile, etc.):
export PATH="$PATH":"$HOME/.pub-cache/bin"
Activated rename 1.3.1.
Documents/DEV/flutter took 7s
Step 2: To change Package name and/or Bundle Id (e.g. com.geekdish.newprojectname):
Rename package using rename tool
> flutter pub global run rename --bundleId com.geekdish.projectname
Step 3: Verify changes
For Android, in the Android Studio/<appname>/android/app/build.gradle
Check the application Id attribute under defaultConfig element, see below
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.geekdish.newflutterproject"
minSdkVersion 16
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
For iOS, in Android Studio, right click <app name>/ios open in Xcode
Click Runner, you will see in the General>Identity>Bundle Identifier the new bundleId com.geekdish.projectname
For macOS, in the Android Studio/<appname>/maos/Runner/Configs/AppInfo.xcconfig
Check the PRODUCT_BUNDLE_IDENTIFIER attribute, see below
// Application-level settings for the Runner target.
//
// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
// future. If not, the values below would default to using the project name when this becomes a
// 'flutter create' template.
// The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = newflutterproject
// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.geekdish.newappname
Step 4: To change Application Name (e.g. newappname):
Rename appName using rename tool
> flutter pub global run rename --appname newappname
Step 5: To verify changes:
For Android, in the Android Studio/<appname>/android/app/src/main/AndroidManifest.xml
Check the android:label= attribute under <manifest>/<application> element, see below
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.geekdish.newprojectname">
<application
android:label="newappname"
android:icon="@mipmap/ic_launcher">
<activity
For iOS, in the Android Studio/<appname>/ios/Runner/Info.plist
Check the <string> attribute under <dict>/<key>/<CFBundleName> element, see below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>newappname</string>
For macOS, in the Android Studio/<appname>/maos/Runner/Configs/AppInfo.xcconfig
Check the PRODUCT_NAME attribute, see below
// Application-level settings for the Runner target.
//
// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
// future. If not, the values below would default to using the project name when this becomes a
// 'flutter create' template.
// The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = newflutterproject