如何更改 Flutter 应用程序的名称?

Ama*_*ani 7 android mobile-application flutter

我刚刚按照这个页面的说明制作了一个 Flutter 应用程序,我在谷歌上搜索了如何更改应用程序的名称,并找到了这个答案。但我无法从清单文件中更改应用程序的名称。最初android:nameio.flutter.app.FlutterApplication。我把Startup Namer它改成 ,它给出了错误

error: attribute 'android:name' in <application> tag must be a valid Java class name.
Run Code Online (Sandbox Code Playgroud)

如何重新解决此错误并更改名称?

Kab*_*uda 11

AndroidManifest.xml针对 Android 和info.plistiOS进行编辑

对于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>
Run Code Online (Sandbox Code Playgroud)

对于iOS ,编辑该文件夹中文件Info.plist中String标记内的值。ios/Runner

代码:

<plist version="1.0">
<dict>
    <key>CFBundleName</key>
    <string>Your Application Name </string>  //here
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)

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


小智 8

应用程序的显示名称由属性标识android:label。您应该更改那个而不是android:name.