You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级logging_to_logcat插件依赖版本后构建失败求助:无法生成KotlinAndroidTarget装饰类

升级logging_to_logcat插件依赖版本后构建失败求助:无法生成KotlinAndroidTarget装饰类

大家好,我最近在尝试把自己的logging_to_logcat插件以及配套的示例应用升级到最新兼容版本,目的是解决旧版本的报错问题,让插件能正常使用,同时示例应用也能顺利跑起来。

我已经把相关依赖版本升级到了这些:

  • JDK(Java Development Kit):21
  • Gradle:8.6(官方说明支持AGP 8.3,我也试过更高版本)
  • Android Gradle Plugin (AGP):8.2.1
  • Kotlin:1.9.20+

结果在构建项目的时候直接失败了,具体的错误信息如下:

FAILURE: Build failed with an exception.

Where:
Build file 'C:\Users\chris\StudioProjects\logging_to_logcat\example\android\app\build.gradle' line: 3

What went wrong:
An exception occurred applying plugin request [id: 'org.jetbrains.kotlin.android', version: '1.9.20']
Failed to apply plugin 'org.jetbrains.kotlin.android'.
Could not create an instance of type org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget.
> Could not generate a decorated class for type KotlinAndroidTarget.
> com/android/build/gradle/api/BaseVariant

我初步猜测可能是Kotlin插件和AGP之间的兼容性不匹配,但不确定具体怎么调整。有没有大佬遇到过类似的情况,或者能帮我分析下这个错误的根源,以及给出可行的解决办法?

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 08:29:31