我已经使用Flutter create testapp创建了应用程序。 现在,我想将应用程序名称从“testapp”更改为“My Trips Tracker”。我该怎么做呢?
我已经尝试从AndroidManifest.xml进行更改,它已经更改,但是Flutter提供了一种方法来做到这一点吗?
我已经使用Flutter create testapp创建了应用程序。 现在,我想将应用程序名称从“testapp”更改为“My Trips Tracker”。我该怎么做呢?
我已经尝试从AndroidManifest.xml进行更改,它已经更改,但是Flutter提供了一种方法来做到这一点吗?
当前回答
有几种可能性:
1-包装的使用:
我建议您使用flutter_launcher_name,因为命令行工具简化了更新Flutter应用程序启动器名称的任务。
用法:
将您的Flutter Launcher名称配置添加到您的pubspec中。yaml文件:
dev_dependencies:
flutter_launcher_name: "^0.0.1"
flutter_launcher_name:
name: "yourNewAppLauncherName"
设置好配置之后,剩下要做的就是运行包。
flutter pub get
flutter pub run flutter_launcher_name:main
如果你使用这个包,你不需要修改文件AndroidManifest.xml或Info.plist。
2-为Android和info编辑AndroidManifest.xml。plist for iOS
对于Android,只编辑AndroidManifest.xml文件中应用程序标签中的Android:label值,该文件位于:Android /app/src/main文件夹中
代码:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Your Application Name" //here
android:icon="@mipmap/ic_launcher">
<activity>
<!-- -->
</activity>
</application>
</manifest>
截图:
对于iOS,只编辑文件信息中的String标签内的值。plist位于ios/Runner文件夹中。
代码:
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Your Application Name </string> //here
</dict>
</plist>
截图:
如果遇到问题,执行扑动清理并重新启动应用程序。
其他回答
它可以帮助您更改您的Flutter项目的AppName和BundleId为不同的平台,目前适用于IOS, Android, macOS和Web
使用实例安装软件包。
pub global activate rename
重命名应用程序,使用以下命令:
pub global run rename --appname "Your App Name"
就是这样!
您可以查看包的文档以获得完整的详细信息,因为它有一些不错的功能,可以选择目标平台等。
第一个 重命名AndroidManifest.xml文件
android:label="Your App Name"
第二个 在Pubspec中重命名应用程序名称。yaml文件 名称:您的应用程序名称
第三 更改应用程序标志
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/path/your Application logo.formate"
第四 运行
flutter pub pub run flutter_launcher_icons:main
安卓
打开AndroidManifest.xml(位于android/app/src/main)
<application
android:label="App Name" ...> // Your app name here
iOS
开放的信息。plist(位于ios/Runner)
<key>CFBundleDisplayName</key>
<string>App Name</string> // Your app name here
和/或
不要忘记停止并再次运行应用程序。
查看默认的应用清单文件AndroidManifest.xml,位于<app dir>/android/app/src/main 编辑android:标签为您想要的显示名称
如果你发布的是多本地化(语言)。
为Android:
在你的应用程序文件夹 android(浏览器名称)\ \ app \ src \ \ res 添加locale文件夹,例如:
values-ar
瓦卢斯恩
然后在每个文件夹中添加一个新的strings.xml,其中包含该语言的应用程序名称。
对基于“增大化现实”技术
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">ادارة الديون</string>
</resources>
for和
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">debt management</string>
</resources>
你能做的最后一件事是到你的AndroidManifest.xml文件 并将android:标签设置为您创建的新文件。
android:label="@string/app_name"