Flutter project fails to build when gradle gets upgraded. Error: Type 'FlutterTask' property 'assets' is missing an input or output annotation
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
- Downgrade your gradle( < 7 )
- 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.
Comments
-
Archit Dandavate over 1 year
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').
-
Type 'FlutterTask' property 'assets' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
- Add an input or output annotation.
- Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#missing_annotation for more details about this problem.
-
Type 'FlutterTask' property 'assetsDirectory' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
- Add an input or output annotation.
- Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#missing_annotation for more details about this problem.
-
Type 'FlutterTask' property 'buildMode' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
- Add an input or output annotation.
- Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#missing_annotation for more details about this problem.
-
Type 'FlutterTask' property 'fastStart' doesn't have a configured value.
Reason: This property isn't marked as optional and no value has been configured.
Possible solutions:
- Assign a value to 'fastStart'.
- Mark property 'fastStart' as optional.
Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#value_not_set for more details about this problem.
-
Type 'FlutterTask' property 'flutterExecutable' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
- Add an input or output annotation.
- Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#missing_annotation for more details about this problem.
-
-
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
-
-
Nikhil Badyal about 3 yearsGo to
android->gradle->wrapper->gradle-wrapper.properties
in the last line change7.0-all
to6.7-all
or whatever you want -
theINtoy about 3 years
./gradlew wrapper --gradle-version 6.8.3
will roll back to the last 6.x version released -
Mohammad Hadi almost 3 yearsit is a temporary solution, we can't use old version for ever, how we can solve this problem with gradle >= 7
-
Nikhil Badyal almost 3 years@MohammadHadi It's(2nd solution) not a temporary solution. Please care to read my answer CAREFULLY. I have referred a PR which solves the issue.
-
Slamit almost 3 yearsThank you for the link to the PR, miroring it worked perfectly!
-
Joel G Mathew over 2 years@ProblematicDude Kindly make your answer more descriptive. What exactly do you mean by make changes as per the PR? Which file to change?
-
Nikhil Badyal over 2 years@JoelGMathew Sure