我正在构建我的应用程序,当构建时发生此错误 -
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
我不知道为什么会出现这个错误,而之前一切正常。请有人帮我解决这个问题。
答案 0 :(得分: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'
}
}
答案 1 :(得分:1)
我已将 android studio 升级到 4.X.X,那时 android studio 自动升级了我所有的 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