androiddependencieshuawei-developersappgallery-connect

AgConnect Performance Monitoring - Version Conflict


With a build.gradle like this (simplified):

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

Module build.gradle (merely alike the Enabling APM tutorial):

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"
}

I get this warning:

--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.

Followed by further problems:

[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

How to upgrade the (bundled) agconnect-apms-plugin version to 1.6.1.303?


Solution

  • To make the versions match, one has to add agconnect-apms-plugin version 1.6.1.300:

    buildscript {
        ...
        ext {
            agp_version = '7.3.1'
            hms_version = '6.7.0.300'
            agc_version = '1.7.3.302'
            apms_version = '1.6.1.300'
        }
        dependencies {
            classpath "com.android.tools.build:gradle:$agp_version"
            classpath "com.huawei.agconnect:agcp:$agc_version"
            classpath "com.huawei.agconnect:agconnect-apms-plugin:$apms_version"
    
        }
    }
    

    And disable the integrated agconnect-apms-plugin 1.5.2.310, which is otherwise being preferred:

    plugins {
        id "com.android.application"
        id "com.huawei.agconnect"
    }
    
    dependencies {
        implementation "com.huawei.hms:base:$hms_version"
        implementation "com.huawei.agconnect:agconnect-core:$agc_version"
        implementation "com.huawei.agconnect:agconnect-apms:$apms_version"
    }
    

    Note: enableAPMS false is the default value; true is what caused the version conflict.