Flutter project fails to build when gradle gets upgraded. Error: Type 'FlutterTask' property 'assets' is missing an input or output annotation

Viewed 14147

When I try to build my application on a usb device, the build crashes displaying this log output

FAILURE: Build failed with an exception.

  • What went wrong: Some problems were found with the configuration of task ':app:compileFlutterBuildDebug' (type 'FlutterTask').

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s Exception: Gradle task assembleDebug failed with exit code 1

Please help to find a solution to this problem

1 Answers

This is happening because you updated gradle in your project to gradle 7. And gradle 7 has some new annotation property which must be reviewed.

I also faced this and filed an issue on github. This is the link

So the choice you have

  1. Downgrade your gradle( < 7 )
  2. Make changes as mentioned in this PR.

In the referred page(Pull Req) . There is a section named Files Changed. See the green colored lines over there. Just edit your gradle file and add/edit same as green colored lines.

Related