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-apmsversion [1.6.1.303] is not same withagconnect-apms-pluginversion [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
相关产品推荐
相关产品推荐

