'A problem was found with the configuration of task ':app:checkDebugManifest' (type 'CheckManifest') in flutter

I was building my app, when this error occured while building -

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:checkDebugManifest' (type 'CheckManifest').
  - Type 'CheckManifest' property 'manifest' has @Input annotation used on property of type 'File'.

    Reason: A property of type 'File' annotated with @Input cannot determine how to interpret the file.

    Possible solutions:
      1. Annotate with @InputFile for regular files.
      2. Annotate with @InputDirectory for directories.
      3. If you want to track the path, return File.absolutePath as a String and keep @Input.

    Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#incorrect_use_of_input_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 1m 0s

I have no idea why this error occured, while everything was working fine just before. Please someone help me with this.



Solution 1:[1]

In my case I got such error after upgrading Gradle to version 7.

I fixed it by updating a version 'com.android.tools.build:gradle' in project build.gradle file:

buildscript {

    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.0'
    }
}

Solution 2:[2]

I have upgrade the android studio to 4.X.X that time android studio automatically upgraded all my gradle files.

You need to check two files

  1. gradle-wrapper.properties
  2. project build.gradle file

In gradle-wrapper.properties need to use

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

and in project build.gradle file

classpath 'com.android.tools.build:gradle:4.2.2

Solution 3:[3]

This error occurs due to the upgraded version of Gradle (Gradle 7+). You can resolve this issue in two ways.

  1. Upgrade the compileSdkVersion to 31 in app build.gradle file,

    android {
        compileSdkVersion 31
        ...
    }
    

    Update gradle build tools version to 4.2+ in project build.gradle file

    buildscript {
       ...
       dependencies {
           classpath 'com.android.tools.build:gradle:4.2.2'
       }
    }
    

or

  1. Downgrade the gradle version to 6.x instead of 7.x

Update gradle distribution version to 6.5 in gradle-wrapper.properties file

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

Update gradle build tools version to 4.2+ in project build.gradle file

buildscript {
   ...
   dependencies {
       classpath 'com.android.tools.build:gradle:4.2.0'
   }
}

Solution 4:[4]

Without downgrading Gradle version (currently 7.0.2), upgrading dependencies gave clearer errors indicating issues with compileSdkVersion.

So I set it to 31 (suggested version), and it completely resolved all the problems.

Tip: Some other problems with kotlin-version and firebase versions came up after, but errors were clear and everything could be fixed just following the details.

Solution 5:[5]

Minimum supported Gradle version is 6.7.1. Current version is 6.5. If using the gradle wrapper

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitry Grushin
Solution 2 Umesh Saraswat
Solution 3 Codemaker
Solution 4 Poorix
Solution 5 Toyib Mustapha