是否有办法更改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。
其他回答
简单的方法,在编辑器中搜索例如vs CODE your.package.name例如com.example.application通过所有文件。
3个AndroidManifest文件(profile, debug, main) 1 build.gradle 1 java 或者kt文件
这些会弹出
替换所有这些,瞧。如果你已经构建了你的项目,build目录中会弹出许多文件,你可以忽略这些文件,不需要更改它们
即使我的答案不会被接受为正确答案,我只是觉得所有这些答案导致我有更多的问题,这里是我如何解决它
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。
如果你还没有开始这个项目,这是最好的方法。
flutter create --org com.yourdomain appname
如果您已经创建了该项目,请在dev_dependencies中安装此包并运行此命令。
flutter pub run change_app_package_name:main com.new.package.name
这将改变所有复杂的东西,改变包的名字在android。右键点击flutter的iOS文件夹,用Xcode打开。
在Xcode >中选择Runner >在general选项卡中你可以改变bundle Identifier。
如果您已经创建了一个项目,并且不知道更改包名的复杂性,那么这是最简单的方法。
我有两个manifest.xml文件在我的应用程序部分,所以我需要改变包的名称
一步一步
在您首选的IDE中打开项目文件夹。 定位pubspec。Yaml文件在项目的根。 将以下行添加到pubspec中。yaml文件:
名称:< your_new_package_name >
在同一目录下,打开“android”文件夹。 打开app文件夹并找到构建。gradle文件。 用新的包名替换当前的包名。 打开ios文件夹。 定位跑步者。ios文件夹中的Xcodeproj文件。 打开信息。plist文件。 用新的包名替换当前的包名。 保存所有更改并关闭文件。 执行命令flutter clean。 最后,运行命令flutter pub get。