升级android studio后编译工程报如下错误:
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
最佳答案
在我的情况下,我在将 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' } }