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

AgConnect性能监控版本冲突:如何升级agconnect-apms-plugin至1.6.1.303?

dependencies {
    classpath "com.android.tools.build:gradle:7.3.1"
    classpath "com.huawei.agconnect:agcp:1.7.3.302"
}

}

## 模块级build.gradle配置
```groovy
plugins {
    id "com.android.application"
    id "com.huawei.agconnect"
}

agcp {
    enableAPMS true
}

dependencies {
    implementation "com.huawei.hms:base:6.7.0.300"
    implementation "com.huawei.agconnect:agconnect-core:1.7.3.302"
    implementation "com.huawei.agconnect:agconnect-apms:1.6.1.303"
}

运行时警告

--W- [APMSClassVisitor] agconnect-apms version [1.6.1.303] is not same with agconnect-apms-plugin version [1.5.2.310], please update one of them, or invalidate AndroidStudio cache if these versions have been same.

运行时错误

[Instrument] an error occurred while instrumenting an unknown class, skipping it: Module requires ASM6
[Instrument] an error occurred while instrumenting an unknown class, skipping it: NestHost requires ASM7
[Instrument] an error occurred while instrumenting an unknown class, skipping it: NestMember requires ASM7

需解决:将捆绑的agconnect-apms-plugin版本升级至1.6.1.303。


解决方案

步骤1:显式声明APMS插件版本

在项目级build.gradle的buildscript依赖块中,直接添加指定版本的agconnect-apms-plugin依赖,覆盖AGCP默认捆绑的旧版本:

buildscript {
    ...
    dependencies {
        classpath "com.android.tools.build:gradle:7.3.1"
        classpath "com.huawei.agconnect:agcp:1.7.3.302"
        // 显式指定APMS插件版本,覆盖捆绑版本
        classpath "com.huawei.agconnect:agconnect-apms-plugin:1.6.1.303"
    }
}

步骤2:同步并清理缓存

  • 点击Android Studio工具栏的Sync Project with Gradle Files按钮,同步项目依赖
  • 若同步后问题仍存在,选择File > Invalidate Caches...,勾选Clear file system cache and local history后重启Android Studio

效果验证

重新构建项目后,版本不匹配的警告会消失,ASM相关错误也会解决——新版本插件已适配更高版本的ASM,修复了指令集兼容性问题。


内容的提问来源于stack exchange,提问作者Martin Zeitler

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.05 11:50:19