简体   繁体   English

Flutter 项目中 gradle Android Studio 中的弃用警告

[英]Deprecation warning in gradle in Android Studio in Flutter project

I have created a Flutter project in Android Studio (Bumblebee | 2021.1.1 Patch 3).我在 Android Studio(Bumblebee | 2021.1.1 补丁 3)中创建了一个 Flutter 项目。 When I open the android folder in a seperate window, when the gradle syncing is being executed, it fails with the message Gradle project sync failed. Basic functionality(eg editing,debugging)当我在单独的 window 中打开android文件夹时,当正在执行 gradle 同步时,它失败并显示消息Gradle project sync failed. Basic functionality(eg editing,debugging) Gradle project sync failed. Basic functionality(eg editing,debugging) will not work properly. Gradle project sync failed. Basic functionality(eg editing,debugging)将无法正常工作。 I ran ./gradlew --warning-mode all in the command line and it's output is我在命令行中运行了./gradlew --warning-mode all ,它是 output

Configure project :app
The AbstractArchiveTask.destinationDir property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the destinationDirectory property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:destinationDir for more details.
    at FlutterPlugin$_addFlutterTasks_closure21$_closure47.doCall(/home/sudipta/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle:863)
    (Run with --stacktrace to get the full stack trace of this deprecation warning.)
The AbstractArchiveTask.archiveName property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveFileName property instead. See https://docs.gradle.org/6.7/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:archiveName for more details.
    at FlutterPlugin$_addFlutterTasks_closure21$_closure47.doCall(/home/sudipta/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle:864)
    (Run with --stacktrace to get the full stack trace of this deprecation warning.)

> Configure project :system_alert_window
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8

> Task :help

Welcome to Gradle 6.7.

To run a build, run gradlew <task> ...

To see a list of available tasks, run gradlew tasks

To see a list of command-line options, run gradlew --help

To see more detail about a task, run gradlew help --task <task>

For troubleshooting, visit https://help.gradle.org

The last warning is due to system_alert_window (flutter)plugin that I am using.最后一个警告是由于我正在使用的system_alert_window (flutter)plugin。 But these deprecation warnings are causing issues in Android Studio editor so that I am unable to use code completion feature.但是这些弃用警告导致 Android Studio 编辑器出现问题,因此我无法使用代码完成功能。 I don't know why is this happening, since these are only warning messages.我不知道为什么会这样,因为这些只是警告消息。

My gradle version is 6.7 and android-gradle version is 4.1.0 .我的 gradle 版本是6.7 ,android-gradle 版本是4.1.0

Can anyone please help?有人可以帮忙吗?

TRY this steps-试试这个步骤-

Step 1:第1步:

Open the gradle.properties file same like given Image-打开与给定图像相同的 gradle.properties 文件-

https://i.stack.imgur.com/S2Y0a.png https://i.stack.imgur.com/S2Y0a.png

Step 2:第2步:

Disable android.enableR8=true by adding a # in front:通过在前面添加 # 来禁用 android.enableR8=true :

#android.enableR8=true

Alternatively, you can swap out the R8 for D8, The build system changed to using D8 instead of R8.或者,您可以将 R8 换成 D8,构建系统更改为使用 D8 而不是 R8。

android.enableD8=true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM