是否有办法更改Flutter项目的Package Name ?
我想在flutter项目中更改包名和应用名。
是否有办法更改Flutter项目的Package Name ?
我想在flutter项目中更改包名和应用名。
当前回答
如果你正在使用VS Code,你可以替换你所有的com。示例到您的包名称
要这样做,CTRL+SHIFT+H 设置单词替换com.example 将单词replace替换为[your package] 然后替换所有
其他回答
我认为这不是解决这个问题的正确办法。但是您可以用您想要的包名创建一个新项目,然后从现有项目中将所有源文件复制到新项目中。
**注意:你也必须复制pubspec的所有内容。在firebase和其他api的情况下,这个解决方案可能有点冗长。
更改Flutter Project的所有AndroidManifest.xml文件,——> package="your.name.app" (app / src /调试/ AndroidManifest.xml)和 (app/src/main/AndroidManifest.xml)和(app/src/profile/AndroidManifest.xml)
好看!!
这是我如何重命名包为ios和android
Go to build.gradle in app module and rename applicationId "com.company.name" Go to Manifest.xml in app/src/main and rename package="com.company.name" and android:label="App Name" Go to Manifest.xml in app/src/debug and rename package="com.company.name" Go to Manifest.xml in app/src/profile and rename package="com.company.name" Go to app/src/main/kotlin/com/something/something/MainActivity.kt and rename package="com.company.name" Go to app/src/main/kotlin/ and rename each directory so that the structure looks like app/src/main/kotlin/com/company/name/ Go to pubspec.yaml in your project and change name: something to name: name, example :- if package name is com.abc.xyz the name: xyz Go 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.name Go to Info.plist click on Bundle name -> rename it to your App Name. close everything -> go to your flutter project and run this command in terminal flutter clean
我有两个manifest.xml文件在我的应用程序部分,所以我需要改变包的名称
使用此插件(2022年)
https://pub.dev/packages/change_app_package_name
使用
flutter pub run change_app_package_name:main com.new.package.name
Old Package Name: com.example.oldname
Updating build.gradle File
Updating Main Manifest file
Updating Debug Manifest file
Updating Profile Manifest file
Project is using kotlin
Updating MainActivity.kt
Creating New Directory Structure
Deleting old directories