【问题标题】:How to change flutter application name display on phone screen?如何更改手机屏幕上的颤振应用程序名称显示?
【发布时间】:2019-05-26 19:00:20
【问题描述】:

如何更改手机上显示的flutter项目的应用名称? 我检查了文件pubspec.yaml

name: flutter_app
description: A new Flutter application.

修改了name的属性,但是导入包引用也会改变,可以只改变应用名吗?

【问题讨论】:

    标签: dart flutter flutter-dependencies


    【解决方案1】:

    安卓

    打开AndroidManifest.xml 文件,进行以下更改

    <application
        android:label="App Name" ...> // Your app name here
    

    iOS

    打开info.plist 文件,进行以下更改

    <key>CFBundleName</key>
    <string>App Name</string> // Your app name here
    

    【讨论】:

    • 这些是执行此操作的本地方法。我想知道颤振是否从单点处理它?
    • @PankajBansal 你的意思是你想动态改名吗?
    • @CopsOnRoad 不,我想知道 iOS 和 android 有什么共同的地方,我可以在其中提供应用名称和图标,因为我知道 IOS(Plist)和 Android(Manifest)的不同。
    • @PankajBansal 很抱歉,目前没有办法,您需要在info.plistAndroidManifest.xml 中进行操作。
    【解决方案2】:

    要更改您的应用程序名称,您需要为 Android 和 IOS 更改它:

    您可以使用rename 包来简化它。

    只需在你的 Flutter 项目根目录中运行此命令

    pub global run rename --appname "My application"
    

    编辑AndroidManifest.xml for Android 和info.plist for iOS

    对于 Android,在 AndroidManifest.xml 文件中的 application 标记中编辑 only 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编辑 Info.plist 文件中 String 标记内的值文件夹ios/Runner .

    代码:

    <plist version="1.0">
    <dict>
        <key>CFBundleName</key>
        <string>Your Application Name </string>  //here
    </dict>
    </plist>
    

    截图:

    如果您遇到问题,请发送flutter clean 并重新启动您的应用程序。

    【讨论】:

      猜你喜欢
      • 2021-12-16
      • 1970-01-01
      • 2023-02-07
      • 1970-01-01
      • 2021-11-15
      • 1970-01-01
      • 2020-11-30
      • 1970-01-01
      • 2020-10-07
      相关资源
      最近更新 更多