【问题标题】:AndroidManifest.xml uses `android:name="io.flutter.app.FutterApplication"`AndroidManifest.xml 使用 `android:name="io.flutter.app.FutterApplication"`
【发布时间】:2022-07-03 23:48:06
【问题描述】:

升级到 Flutter 2.10 后出现如下错误:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It is being deprecated in favor of Android embedding v2. Follow the
steps at

https://flutter.dev/go/android-project-migration

to migrate your project. You may also pass the --ignore-deprecation flag to
ignore this check and continue with the deprecated v1 embedding. However,
the v1 Android embedding will be removed in future versions of Flutter.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The detected reason was:

  /android/app/src/main/AndroidManifest.xml uses `android:name="io.flutter.app.FutterApplication"`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

我已经升级到 Flutter embedding 2,这个错误如何解决?

【问题讨论】:

    标签: flutter


    【解决方案1】:

    我可以通过将android:name 设置为来解决这个问题

    android:name="${applicationName}" in android/app/src/main/AndroidManifest.xml:

        <application
            android:name="${applicationName}"
    

    显然,Flutter 2.10 比以前的版本有更严格的检查。

    【讨论】:

    • 我在从 Flutter 1.22.6 迁移到 2.2.3 时也这样做了,这个更改导致构建失败,因为在任何地方都找不到 applicationName。 “升级 1.12 之前的 Android 项目”指南除了“做”之外,甚至没有说任何关于这一行的内容。而在 Flutter 2.2.3 以后创建的 Flutter 项目中,这条线不再存在,可能是因为它是可选的(参见here)。
    【解决方案2】:

    完整指南请click

    【讨论】:

      【解决方案3】:

      打开你的 AndroidManifest.xml 只需删除这一行android:name="io.flutter.app.FlutterApplication"

      【讨论】:

      • 唯一对我有用的。
      【解决方案4】:

      有两种解决方案

      第一种解决方案,可以替换

      android:name="io.flutter.app.FutterApplication"

      android:name="${applicationName}"

      第二种解决方案,删除

      android:name="io.flutter.app.FutterApplication"

      并运行您的代码

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多