【问题标题】:How to change the name of Flutter Application?如何更改 Flutter 应用程序的名称?
【发布时间】:2019-02-27 05:53:32
【问题描述】:

我刚刚按照this page的说明做了一个Flutter应用,我google了如何更改应用程序的名称,找到了this answer。但我无法从清单文件中更改应用程序的名称。最初 android:nameio.flutter.app.FlutterApplication。我把它改成Startup Namer,它给出了错误

error: attribute 'android:name' in <application> tag must be a valid Java class name.

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

【问题讨论】:

  • 你试过没有StartupNamer之间的空格吗?
  • 我试了一下,还是一样的错误。但是,我看到另一个参数android:label,将其更改为Startup Namer,并且它起作用了。

标签: android flutter mobile-application


【解决方案1】:

编辑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 并重新启动您的应用程序。

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2021-02-24
      • 2021-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-14
      • 2011-07-23
      • 2010-09-19
      • 1970-01-01
      相关资源
      最近更新 更多