Android | 开发过程遇到的报错以及解决方法

注: 此博客为记录个人开发过程中遇到的报错问题以及解决方案。

由于不同版本环境等因素影响,解决方案对其他人可能无效。

本博客仅提供一种解决思路,具体问题请具体分析。

  • 报错:Gradle报错:

    1: Task failed with an exception.


    • What went wrong:

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

    复制代码
    - Type 'com.android.build.gradle.internal.tasks.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.2/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.

    ==============================================================================

  • 解决:将gradle-wrapper.properties中的gradle版本降级

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

修改为

复制代码
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Java version First Gradle version to support it
8 2.0
9 4.3
10 4.7
11 5.0
12 5.4
13 6.0
14 6.3
15 6.7
16 7.0
17 7.3
18 7.5
19 7.6
20 8.1
[Java版本与Gradle版本对应]

注:在Android Studio修改Java版本方法:

  • 报错:
  • 参考:
  • 解决:

(未完待续...)

相关推荐
杉氧3 小时前
Navigation Compose 深度实践:如何优雅地串联起你的全栈 App?
android·架构·android jetpack
雨白7 小时前
指针与数组的核心机制
android
黄林晴11 小时前
Room 3.0 正式发布!包名彻底重构,KMP 成为核心主线
android·android jetpack
三少爷的鞋12 小时前
Kotlin 协程环境下的 DCL 懒加载:别把线程时代的经验直接搬过来
android
plainGeekDev12 小时前
Gson → kotlinx.serialization
android·java·kotlin
CYY951 天前
Compose 入门篇
android·kotlin
杉氧1 天前
Compose 时代的 MVI 架构:如何用单向数据流驱动复杂 UI?
android·架构·android jetpack
杉氧1 天前
Modifier 的艺术:为什么链式调用的顺序决定了UI 的生命周期?
android·架构·android jetpack
李斯维1 天前
腾讯 XLog 日志框架 Android 端接入
android·android studio·android jetpack