【问题标题】:A problem was found with the configuration of task ':app:checkDebugManifest' (type 'CheckManifest') in flutter在flutter中发现任务':app:checkDebugManifest'(类型'CheckManifest')的配置有问题
【发布时间】:2021-07-22 19:41:33
【问题描述】:

我正在构建我的应用程序,但在构建时发生此错误 -

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

我不知道为什么会发生此错误,而之前一切正常。请有人帮我解决这个问题。

【问题讨论】:

  • 我从 3 天前就遇到了同样的问题,但我仍然无法解决。
  • @juliosegura 好吧,我刚刚将 grafle 版本降级到 5.4.6 并且它工作正常。虽然我想知道,但如果我们想使用 gradle 版本 7,我们该如何消除这个错误
  • @Shrenyansh 你说得对,我将 gradle 版本降级为 5.6.4 并解决了问题。谢谢!
  • @juliosegura 没问题,兄弟。如果您喜欢我的问题和回答,请考虑点赞。

标签: android ios flutter dart


【解决方案1】:

由于 Gradle 的升级版本(Gradle 7+)而出现此错误。您可以通过两种方式解决此问题。

  1. 将应用程序build.gradle文件中的compileSdkVersion升级为31,

    android {
        compileSdkVersion 31
        ...
    }
    

    将项目build.gradle文件中的gradle build tools版本更新为4.2+

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

  1. 将 gradle 版本降级为 6.x 而不是 7.x

gradle-wrapper.properties 文件中将 gradle 分发版本更新为 6.5

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

将项目build.gradle文件中的gradle build tools版本更新为4.2+

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

【讨论】:

    【解决方案2】:

    在不降级 Gradle 版本(当前为 7.0.2)的情况下,升级依赖项会给出更清晰的错误,表明 compileSdkVersion 存在问题。

    所以我将其设置为31(建议版本),它彻底解决了所有问题。

    提示kotlin-versionfirebase 版本之后出现了一些其他问题,但错误很明显,所有问题都可以按照细节进行修复。

    【讨论】:

      【解决方案3】:

      我已经将 android studio 升级到 4.X.X,那时 android studio 自动升级了我所有的 gradle 文件。

      你需要检查两个文件

      1. gradle-wrapper.properties
      2. 项目 build.gradle 文件

      在gradle-wrapper.properties中需要用到

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

      并在项目 build.gradle 文件中

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

      【讨论】:

        【解决方案4】:

        在我的情况下,我在将 Gradle 升级到版本 7 后遇到了这样的错误。

        我通过在项目 build.gradle 文件中更新版本“com.android.tools.build:gradle”来修复它:

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

        【讨论】:

        • 非常感谢!它也对我有用!
        猜你喜欢
        • 2022-06-14
        • 2022-10-18
        • 2021-01-11
        • 1970-01-01
        • 1970-01-01
        • 2021-08-29
        • 2021-10-12
        • 1970-01-01
        • 2021-07-03
        相关资源
        最近更新 更多