是否有办法更改Flutter项目的Package Name ?
我想在flutter项目中更改包名和应用名。
是否有办法更改Flutter项目的Package Name ?
我想在flutter项目中更改包名和应用名。
当前回答
即使我的答案不会被接受为正确答案,我只是觉得所有这些答案导致我有更多的问题,这里是我如何解决它
Get Sublime Text (crazy, right? No, just follow my steps) Click on file and select open folder, then choose the folder of the project you are working on Now click on Find from the Tabs, and select find in files or just do Ctrl + Shift + F (for Windows users, for mac users you already know the drill) Now copy and paste exactly the name of the package you want to change in the Find section and paste in the replace section what you would like to replace the package name with. Click on FIND (do not click on REPLACE just yet). Now clicking on Find lists all available package name in your project which matches your search criteria, if you are satisfied with this then repeat from no. 3 but this time click on REPLACE. Rebuild your project and have fun
结论:一个简单的查找和替换程序就可以解决这个问题,我强烈推荐Sublime Text 3。
其他回答
Android和Ios的默认路径更改的权利。
为安卓
AndroidManifest.xml开放,
走这条路。
/ src /游戏/应用AndroidManifest . xml
选择软件包名称,然后右键单击,
点击重命名后,重命名弹出(对话框)显示。
在这里输入新的包名,
更改名称文本后,单击重构按钮。
__________________________________________________________________________
为Ios
从抽屉中选择ios文件夹,右键点击这些文件夹,
选择,并双击运行在抽屉,然后选择一般
然后,改变你的包标识符(包名)。 更改包标识符(包名)后,您的包名为 为Ios更改。
即使我的答案不会被接受为正确答案,我只是觉得所有这些答案导致我有更多的问题,这里是我如何解决它
Get Sublime Text (crazy, right? No, just follow my steps) Click on file and select open folder, then choose the folder of the project you are working on Now click on Find from the Tabs, and select find in files or just do Ctrl + Shift + F (for Windows users, for mac users you already know the drill) Now copy and paste exactly the name of the package you want to change in the Find section and paste in the replace section what you would like to replace the package name with. Click on FIND (do not click on REPLACE just yet). Now clicking on Find lists all available package name in your project which matches your search criteria, if you are satisfied with this then repeat from no. 3 but this time click on REPLACE. Rebuild your project and have fun
结论:一个简单的查找和替换程序就可以解决这个问题,我强烈推荐Sublime Text 3。
安卓
在Android中,包名在AndroidManifest中:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
package="com.example.appname">
iOS
在iOS中,包名是Info.plist中的包标识符:
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
在Runner.xcodeproj/project.pbxproj中找到:
PRODUCT_BUNDLE_IDENTIFIER = com.example.appname;
更改名称
包名在不止一个位置,因此要更改名称,您应该在整个项目中搜索旧项目名的出现情况并全部更改它们。
Android Studio和VS Code:
Mac: Command + Shift + F Linux/Windows: Ctrl + Shift + F
感谢diegoveloper在iOS方面的帮助。
更新:
在回到这个页面几次之后,我认为用正确的名称开始一个新项目,然后复制旧文件会更容易、更干净。
对于像我这样不喜欢更改特定文件的人,我使用了https://pub.dev/packages/rename。
使用这个,你只需要在你的终端上运行这些命令,你的应用名称和标识符就会被改变。酒吧全球运营
正在安装:pub全局激活重命名
然后,在颤振项目根目录中运行此命令。
pub全局运行rename——bundleId com.example.android.app——目标android
更改pubspec中的name属性。Yaml(第一行)
对于apk的名称,修改AndroidManifest.xml中的android:label