如何更改 Flutter 应用程序的名称?
How to change the name of Flutter Application?
我刚刚按照 this page, and I googled how to change the name of the application, and found 的说明制作了一个 Flutter 应用程序。但我无法从清单文件中更改应用程序的名称。最初 android:name
是 io.flutter.app.FlutterApplication
。我将其更改为 Startup Namer
,它给出了错误
error: attribute 'android:name' in <application> tag must be a valid Java class name.
如何解决这个错误并更改名称?
应用程序的显示名称由属性 android:label
标识。你应该改变那个而不是 android:name
.
为 Android 编辑 AndroidManifest.xml
,为 iOS
编辑 info.plist
对于Android,仅编辑 android:label
应用程序中的值[=文件 AndroidManifest.xml 中的 41=] 标记位于文件夹中: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标签内的值在文件 Info.plist 中位于文件夹 ios/Runner
.
代码:
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Your Application Name </string> //here
</dict>
</plist>
如果遇到问题,请执行 flutter clean
并重新启动您的应用程序。
我刚刚按照 this page, and I googled how to change the name of the application, and found android:name
是 io.flutter.app.FlutterApplication
。我将其更改为 Startup Namer
,它给出了错误
error: attribute 'android:name' in <application> tag must be a valid Java class name.
如何解决这个错误并更改名称?
应用程序的显示名称由属性 android:label
标识。你应该改变那个而不是 android:name
.
为 Android 编辑 AndroidManifest.xml
,为 iOS
info.plist
对于Android,仅编辑 android:label
应用程序中的值[=文件 AndroidManifest.xml 中的 41=] 标记位于文件夹中: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标签内的值在文件 Info.plist 中位于文件夹 ios/Runner
.
代码:
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Your Application Name </string> //here
</dict>
</plist>
如果遇到问题,请执行 flutter clean
并重新启动您的应用程序。