I have added rename: ^2.0.1 and gave pub get. then I run this command
pub global run rename --bundleId com.hit.fantomcarpentry
but Im getting below error,
'pub' is not recognized as an internal or external command, operable program or batch file.
how to correct this. I want to change my package name.
current package name
package="com.hit.fixing_to_do"
4 Answers 4
Try this command, you should include flutter before pub in command and make sure you are in the project directory:
flutter pub global run rename --bundleId com.hit.fantomcarpentry
If not work follow alternative solution:
You can use change_app_package_name.
To use this, add this package in pubsec.yaml
dev_dependencies:
change_app_package_name: ^1.0.0
Not migrated to null safety yet? use old version like this
dev_dependencies:
change_app_package_name: ^0.1.3
then run this command in project directory:
flutter pub get
flutter pub run change_app_package_name:main com.new.package.name
1 Comment
You can use https://pub.dev/packages/change_app_package_name
Add below in your pubspec.yaml file, save your file.
dev_dependencies:
change_app_package_name: ^1.1.0
and Run this command to change package name
flutter pub run change_app_package_name:main com.new.package.name
Comments
This is how you can renamed package for both ios and android
Go to build.gradle in app module and rename
applicationId "com.company.name"Go to Manifest.xml in
app/src/mainand renamepackage="com.company.name"andandroid:label="App Name"Go to Manifest.xml in
app/src/debugand renamepackage="com.company.name"Go to Manifest.xml in
app/src/profileand renamepackage="com.company.name"Go to
app/src/main/kotlin/com/something/something/MainActivity.ktand renamepackage="com.company.name"Go to
app/src/main/kotlin/and rename each directory so that the structure looks likeapp/src/main/kotlin/com/company/name/Go to
pubspec.yamlin your project and changename: somethingtoname: name,example :- if package name iscom.abc.xyzthename: xyzGo to each dart file in lib folder and rename the imports to the modified name.
Open XCode and open the runner file and click on Runner in project explorer.
Go to General -> double click on Bundle Identifier -> rename it to
com.company.nameGo to
Info.plistclick onBundle name -> renameit to your App Name. close everything -> go to your flutter project and run this command in terminalflutter clean
Comments
To Change package name in build build.gradle only
defaultConfig {
applicationId "your.package.name"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
For iOS
Change the bundle identifier from your Info.plist file inside your ios/Runner directory.
<key>CFBundleIdentifier</key>
<string>com.your.packagename</string>