zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

Flutter Android embedding升级到v2

Androidflutter 升级 V2 embedding
2023-09-27 14:22:49 时间

一、背景

为了更好地支持将Flutter添加到现有项目的执行环境,旧的Android平台端包装器在io.flutter.app.FlutterActivity及其相关类托管Flutter运行时已被弃用。取而代之的则是io.flutter.embedding.android.FlutterActivity及其相关的类。如果我们不进行升级,那么运行flutter doctor命令时会报如下的错误。

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:

  No `/Users/mac/android/AndroidManifest.xml` file
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

如果是纯Flutter工程,