我已经使用Flutter create testapp创建了应用程序。 现在,我想将应用程序名称从“testapp”更改为“My Trips Tracker”。我该怎么做呢?

我已经尝试从AndroidManifest.xml进行更改,它已经更改,但是Flutter提供了一种方法来做到这一点吗?


当前回答

更新:从评论来看,这个答案似乎已经过时了

Flutter文档指出了可以在Android和iOS上更改应用程序显示名称的位置。这可能就是你想要的:

准备Android应用发行 准备发布iOS应用

为安卓

似乎你已经在AndroidManifest.xml中找到了这个应用程序条目。

查看默认的应用程序清单文件AndroidManifest.xml /android/app/src/main/并验证值是否正确 特别是: 编辑application标签中的android:标签以反映应用程序的最终名称 应用程序。

为iOS

请参阅Review Xcode项目设置部分:

在Xcode中导航到你的目标设置: 在Xcode中,打开Runner。Xcworkspace在应用程序的ios文件夹中。

要查看应用程序的设置,请选择Xcode项目中的Runner项目 导航器。然后,在主视图侧栏中,选择Runner目标。

选择General选项卡。接下来,您将验证最重要的内容 设置: “显示名称”:在主界面显示的应用名称 和其他地方。

其他回答

第一个 重命名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

你可以通过编辑文件*project/ iOS /Runner/info.plist在iOS中修改它,而不需要打开Xcode。设置<key>CFBundleDisplayName</key>为你想要作为你的名字的字符串。

对于Android,在AndroidManifest.xml文件中的Android文件夹中更改应用程序名称,Android /app/src/main。让android标签引用你喜欢的名称,例如,

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    <application
        android:label="test"
        // The rest of the code
    </application>
</manifest>

如果你发布的是多本地化(语言)。

为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"

对于Android,从Android文件夹中更改应用程序名称。在AndroidManifest.xml文件中,在android/app/src/main文件夹中,让android标签引用你喜欢的名称,例如:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    <application
        `android:label="myappname"`
        // The rest of the code
    </application>
</manifest>

如果你像我一样喜欢从命令行自动化一些东西,你可以使用这个

appName="TestApp"
declare -a androidAppTypes=(
    "main"
    "debug"
    "profile"
)

# Change app name for Android
for appType in ${androidAppTypes[@]}
do
    xmlstarlet ed -L -u '/manifest/application/@android:label' -v "$appName" android/app/src/$appType/AndroidManifest.xml
done

# Change app name for Android
plutil -replace CFBundleDisplayName -string "$appName" ios/Runner/Info.plist