flutter构建apk运行错误迁移原因

问题描述 投票:0回答:1

我每次都会遇到相同的构建错误

You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

我在 android studio 和 vscode 中运行相同的结果

flutter dart gradle build
1个回答
0
投票

要解决此问题,简单的方法是删除项目中的 android 文件夹,然后在项目目录中运行

flutter create .
命令,然后在这个新创建的 android 文件夹中再次添加之前在 android 文件夹中完成的任何操作,例如权限或本机代码等。

解决此问题的另一种方法是手动更改 gradle 文件,这有点复杂,如果不仔细遵循步骤可能会导致问题。 步骤如下

© www.soinside.com 2019 - 2024. All rights reserved.