文章目錄
- 出現場景
- 解決方案
-
- 編輯android/settings.gradle
- 編輯android/build.gradle
-
- 重新定義庫變量
- 編輯android/app/build.gradle
-
- 刪除fluttetRoot和plugin字段
- 添加plugins塊
- 修改dependencies
出現場景
ado@adodeMacBook-Air app_demo % flutter run --profile
Launching lib/main.dart on SM G977U in profile mode...
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/to/flutter-gradle-plugin-applyYou 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/to/flutter-gradle-plugin-applyRunning Gradle task 'assembleProfile'... 17.7s
運行在安卓時,出現以上的警告.
解決方案
這是因為從Flutter
3.16開始,Android gradle插件使用plugin dsl語法 plugins{}
塊,
以下是移植方法