Could not find com.huawei.hms:hwid:5.3.0.301 & push kit when adding HMS alongside GMS using HMS Toolkit

Viewed 2168

I'm trying to add the HMS into our GMS first app. This is a massive application so we decided to try the HMS Toolkit conversion software. The toolkit added the necessary dependencies and modules and made the appropriate replacements where needed but when I try to build our application, I get the following errors regarding the generated module's dependencies:

Execution failed for task ':xmsadapter:generateDebugRFile'.
> Could not resolve all files for configuration ':xmsadapter:debugCompileClasspath'.
   > Could not find com.huawei.hms:hwid:5.3.0.301.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/huawei/hms/hwid/5.3.0.301/hwid-5.3.0.301.pom
       - https://jcenter.bintray.com/com/huawei/hms/hwid/5.3.0.301/hwid-5.3.0.301.pom
       - https://dl.google.com/dl/android/maven2/com/huawei/hms/hwid/5.3.0.301/hwid-5.3.0.301.pom
       - https://developer.huawei.com/repo/com/huawei/hms/hwid/5.3.0.301/hwid-5.3.0.301.pom
     Required by:
         project :xmsadapter
   > Could not find com.huawei.hms:push:5.3.0.300.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/huawei/hms/push/5.3.0.300/push-5.3.0.300.pom
       - https://jcenter.bintray.com/com/huawei/hms/push/5.3.0.300/push-5.3.0.300.pom
       - https://dl.google.com/dl/android/maven2/com/huawei/hms/push/5.3.0.300/push-5.3.0.300.pom
       - https://developer.huawei.com/repo/com/huawei/hms/push/5.3.0.300/push-5.3.0.300.pom
     Required by:
         project :xmsadapter

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':xmsadapter:xmsaux:xh:processDebugResources'.
> Could not resolve all files for configuration ':xmsadapter:xmsaux:xh:debugCompileClasspath'.
   > Could not find com.huawei.hms:push:5.3.0.300.
     Required by:
         project :xmsadapter:xmsaux:xh

Why can't gradle find the push and hwid kits in huawei's repos?

xmsadapter build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'com.huawei.agconnect'
apply from: 'scripts/productFlavor.gradle'

android {
    compileSdkVersion 29
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 29
    }

    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }

}

dependencies {
    //Account
    compileOnly 'com.google.android.gms:play-services-base:17.1.0'
    compileOnly 'com.google.android.gms:play-services-auth-base:17.1.0'
    compileOnly 'com.google.android.gms:play-services-basement:17.1.0'
    compileOnly 'com.google.android.gms:play-services-auth-api-phone:17.4.0'
    compileOnly 'com.huawei.hms:hwid:5.3.0.301'
    compileOnly 'com.google.android.gms:play-services-auth:18.0.0'
    //Basement
    compileOnly 'com.huawei.hms:base:6.0.1.302'
    compileOnly 'com.google.android.gms:play-services-tasks:17.0.0'
    //Push
    compileOnly 'com.google.android.gms:play-services-gcm:17.0.0'
    compileOnly 'com.google.firebase:firebase-messaging:20.2.0'
    compileOnly 'com.huawei.hms:hianalytics:6.1.0.300'
    compileOnly 'com.google.firebase:firebase-core:17.0.0'
    compileOnly 'com.huawei.hms:push:5.3.0.300'
    //Crashlytics
    compileOnly 'com.google.firebase:firebase-crashlytics:17.0.0-beta02'
    compileOnly 'com.huawei.agconnect:agconnect-crash:1.5.0.300'
    //Analytics
    compileOnly 'com.google.firebase:firebase-analytics:18.0.0'
    compileOnly 'com.google.android.gms:play-services-analytics:17.0.0'
}

xmsaux build.gradle:

apply plugin: 'com.android.library'
apply from: '../scripts/productFlavor.gradle'
apply from: 'scripts/copy-dex.gradle'

android {
    compileSdkVersion 29
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 29

        consumerProguardFiles 'proguard.txt'
    }

    buildTypes {
        debug {
            buildConfigField("String", "XG_BIN_NAME", "\"xg.apk\"")
            buildConfigField("String", "XH_BIN_NAME", "\"xh.apk\"")
        }
        release {
            buildConfigField("String", "XG_BIN_NAME", "\"xg.apk\"")
            buildConfigField("String", "XH_BIN_NAME", "\"xh.apk\"")
        }
    }

    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}

dependencies {
    compileOnly project(':xmsadapter')

    //Account
    compileOnly 'com.google.android.gms:play-services-base:17.1.0'
    compileOnly 'com.google.android.gms:play-services-auth-base:17.1.0'
    compileOnly 'com.google.android.gms:play-services-basement:17.1.0'
    compileOnly 'com.google.android.gms:play-services-auth-api-phone:17.4.0'
    compileOnly 'com.huawei.hms:hwid:5.3.0.301'
    compileOnly 'com.google.android.gms:play-services-auth:18.0.0'
    //Basement
    compileOnly 'com.huawei.hms:base:6.0.1.302'
    compileOnly 'com.google.android.gms:play-services-tasks:17.0.0'
    //Push
    compileOnly 'com.google.android.gms:play-services-gcm:17.0.0'
    compileOnly 'com.google.firebase:firebase-messaging:20.2.0'
    compileOnly 'com.huawei.hms:hianalytics:6.1.0.300'
    compileOnly 'com.google.firebase:firebase-core:17.0.0'
    compileOnly 'com.huawei.hms:push:5.3.0.300'
    //Crashlytics
    compileOnly 'com.google.firebase:firebase-crashlytics:17.0.0-beta02'
    compileOnly 'com.huawei.agconnect:agconnect-crash:1.5.0.300'
    //Analytics
    compileOnly 'com.google.firebase:firebase-analytics:18.0.0'
    compileOnly 'com.google.android.gms:play-services-analytics:17.0.0'

}


afterEvaluate {
    Project project ->
        def cleanTask = project.tasks.getByName('clean')
        cleanTask.doLast {
            File assetsPath = new File(project.android.sourceSets.main.assets.srcDirs[0].path);
            assetsPath.deleteDir();
        }
}

project-level build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.4.0'
    ext.gson_version = '2.8.6'

    repositories {
        mavenCentral()
        jcenter()
        google()
        maven {
            url 'https://developer.huawei.com/repo/'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.2'
        classpath 'com.google.gms:google-services:4.3.5' // google-services plugin
        classpath 'com.google.firebase:perf-plugin:1.3.4'  // Performance Monitoring plugin

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"

        classpath 'com.huawei.agconnect:agconnect-apms-plugin:1.4.1.305'
        classpath 'com.huawei.agconnect:agcp:1.4.2.300'

        // Add the Crashlytics Gradle plugin
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
        // Add the App Distribution Gradle plugin
        classpath 'com.google.firebase:firebase-appdistribution-gradle:2.1.3'
    }
}

allprojects {
    repositories {
        mavenCentral()
        jcenter()
        google()
        maven {
            url 'https://developer.huawei.com/repo/'
        }
    }

    buildscript {
        repositories {
            mavenCentral()
            jcenter()
            google()
        }
    }
}

app module build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.appdistribution'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'jacoco'
apply plugin: 'de.undercouch.download'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlinx-serialization'
apply plugin: 'com.google.gms.google-services'
apply from: '../xmsadapter/scripts/productFlavor.gradle'

////////////////////////////////////////////////////////////////////////
// The app's version name. Increment this before you make a new release!
////////////////////////////////////////////////////////////////////////
def getVersionName = { ->
    return "6.2.1"
}

/////////////////////////////////////////////////////////////////////////////////
// The whatsNewScreen version name. Increment this before you make a new release!
/////////////////////////////////////////////////////////////////////////////////
def getWhatsNewVersion = { ->
    return "6.2.1"
}

def getVersionCode = { ->
    int FALLBACK_NUMBER = 1
    int buildNumber = System.getenv("BUILD_NUMBER") as Integer ?: FALLBACK_NUMBER
    if (buildNumber == FALLBACK_NUMBER) {
        println "Environment variable BUILD_NUMBER is not set."
    }
    println "VersionCode is set to $buildNumber"
    return buildNumber
}

/////////////////////////////////////////////////////////
// update string res from locolise.biz
// run: gradlew updateTranslations
////////////////////////////////////////////////////////

task downloadTranslationsZipFile(type: Download) {
    src 'https://localise.biz/api/export/archive/xml.zip?filter={redacted}'
    dest new File(buildDir, 'translations.zip')
}

task openTranslations(dependsOn: downloadTranslationsZipFile, type: Copy) {
    from zipTree(downloadTranslationsZipFile.dest)
    into buildDir
    include "{redacted}"
}

task updateTranslations(dependsOn: openTranslations, type: Copy) {
    from new File(buildDir, '{redacted}-mobile-xml-archive/res')
    into 'src/main/res'
}

android {
    compileSdkVersion 29

    dexOptions {
        preDexLibraries = false
    }

    signingConfigs {
        release {
            storeFile file(keyStoreFile)
            keyAlias keyStoreAlias
            keyPassword keyPw
            storePassword storePw
        }
        development {
            storeFile file("dev.keystore")
            keyAlias "androiddebugkey"
            keyPassword "android"
            storePassword "android"
        }
    }

    defaultConfig {
        applicationId "{redacted}"
        manifestPlaceholders = [hostNameProd: "{redacted}",
                                hostNameStaging: "{redacted}",
                                fbScheme: "{redacted}"]
        minSdkVersion 21
        targetSdkVersion 29
        versionCode getVersionCode()
        versionName getVersionName()
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        // limit which language resources are taken into apk
        resConfigs "en", "fr", "el", "de", "it", "es", "ru"
        vectorDrawables.useSupportLibrary = true
        buildConfigField "boolean", "RELEASE_BACKEND", "false"
    }

    packagingOptions {
        exclude 'LICENSE.txt' // needed for tests
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'

        exclude('org/apache/commons/codec/language/bm/*.txt')
        //  124 files (uncompressed 215kb) with unused language specific rules
    }

    lintOptions {
        abortOnError false
    }

    buildTypes {
        debug {
            resValue "string", "app_name", "DEBUG {redacted}"
            applicationIdSuffix ".debug" // will override ACPT version
            versionNameSuffix "-debug"
            debuggable true
            minifyEnabled false
            shrinkResources false
            buildConfigField "boolean", "ENABLE_DIAGNOSTICS", "false"
            ext.enableCrashlytics = false

            pseudoLocalesEnabled true
            buildConfigField "String", "WHATS_NEW_VERSION", "\"${getWhatsNewVersion()}\""

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            matchingFallbacks = ['release']
            lintOptions {
                disable 'MissingTranslation'
            }
        }

        development {
            resValue "string", "app_name", "DEV {redacted}"
            applicationIdSuffix ".development" // will override ACPT version
            versionNameSuffix "-development"
            debuggable true
            minifyEnabled false
            shrinkResources false
            buildConfigField "boolean", "ENABLE_DIAGNOSTICS", "true"
            ext.enableCrashlytics = false

            pseudoLocalesEnabled true
            buildConfigField "String", "WHATS_NEW_VERSION", "\"${getWhatsNewVersion()}\""

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            matchingFallbacks = ['release']
            firebaseAppDistribution {
                serviceCredentialsFile = firebaseDistributionFile
                groups = '{redacted}-internal, lit-testers'
            }
        }

        snapshot {
            resValue "string", "app_name", "SNAP {redacted}"
            applicationIdSuffix ".snapshot"
            versionNameSuffix "-snapshot"
            debuggable true
            minifyEnabled false
            shrinkResources false
            buildConfigField "boolean", "ENABLE_DIAGNOSTICS", "false"
            ext.enableCrashlytics = true

            pseudoLocalesEnabled true
            buildConfigField "String", "WHATS_NEW_VERSION", "\"${getWhatsNewVersion()}\""

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            matchingFallbacks = ['release']
            firebaseAppDistribution {
                serviceCredentialsFile = firebaseDistributionFile
                groups = '{redacted}-internal, lit-testers'
            }
        }

        acceptance {
            resValue "string", "app_name", "ACPT {redacted}"
            applicationIdSuffix ".acceptance"
            versionNameSuffix "-acceptance"
            debuggable true
            minifyEnabled true
            shrinkResources true
            buildConfigField "boolean", "ENABLE_DIAGNOSTICS", "true"
            ext.enableCrashlytics = true

            buildConfigField "String", "WHATS_NEW_VERSION", "\"${getWhatsNewVersion()}\""

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            matchingFallbacks = ['release']
            firebaseAppDistribution {
                serviceCredentialsFile = firebaseDistributionFile
                groups = '{redacted}-internal, lit-testers'
            }
        }

        release {
            resValue "string", "app_name", "{redacted}"
            minifyEnabled true
            shrinkResources true
            buildConfigField "boolean", "ENABLE_DIAGNOSTICS", "true"
            ext.enableCrashlytics = true

            buildConfigField "String", "WHATS_NEW_VERSION", "\"${getWhatsNewVersion()}\""
            buildConfigField "boolean", "RELEASE_BACKEND", "true"
            manifestPlaceholders = [hostName: "{redacted}",
                                    fbScheme: "{redacted}"]

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            firebaseAppDistribution {
                serviceCredentialsFile = firebaseDistributionFile
                groups = '{redacted}-internal, lit-testers'
            }
        }

        debugProd {
            initWith(debug)
            ext.enableCrashlytics = false
            buildConfigField "boolean", "RELEASE_BACKEND", "true"
            matchingFallbacks = ['release']
        }

        unitTest {
            testCoverageEnabled = true

            // same as debug!
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug"
            // disable crashlytics and gtm for developer builds
            buildConfigField "boolean", "ENABLE_DIAGNOSTICS", "false"
            ext.enableCrashlytics = false

            resValue "string", "app_name", "DEBUG {redacted}"

            // adds version name for whatsNew feature
            buildConfigField "String", "WHATS_NEW_VERSION", "\"${getWhatsNewVersion()}\""

            matchingFallbacks = ['release']
        }
    }

    sourceSets {

        development {
            java.srcDirs = ['src/debug/java']
            res.srcDirs = ['src/debug/res']
            assets.srcDirs = ['src/debug/assets']
        }

        snapshot {
            java.srcDirs = ['src/debug/java']
            res.srcDirs = ['src/debug/res']
            assets.srcDirs = ['src/debug/assets']
        }

        acceptance {
            java.srcDirs = ['src/debug/java']
            res.srcDirs = ['src/acceptance/res', 'src/debug/res']
            assets.srcDirs = ['src/debug/assets']
        }

        release {
            java.srcDirs = ['src/release/java']
        }

        debugProd {
            java.srcDirs = ['src/debug/java']
            res.srcDirs = ['src/debug/res']
            assets.srcDirs = ['src/debug/assets']
        }
    }

    project.archivesBaseName = "${new Date().format("yyMMdd")}{redacted}${getVersionName()}_${getVersionCode()}"

    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }

    android.applicationVariants.all { variant ->

        variant.buildConfigField "String", "LANGUAGES", "\"${variant.mergedFlavor.resourceConfigurations.join(',')}\""

        if (variant.buildType.pseudoLocalesEnabled) {
            variant.mergedFlavor.resourceConfigurations.add("en-rXA")
            variant.mergedFlavor.resourceConfigurations.add("ar-rXB")
        }
    }
}

dependencies {
    implementation project(':xmsadapter')
    implementation project(':xmsadapter:xmsaux')
    compileOnly project(':xmsadapter:xmsaux:xapi')
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // Modules
    implementation project(':backends')
    implementation project(':pdflib')

    // Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

    // KotlinX
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
    implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:1.0-M1-1.4.0-rc"

    // AndroidX
    implementation "androidx.lifecycle:lifecycle-runtime:2.3.1"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
    implementation 'androidx.viewpager2:viewpager2:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.browser:browser:1.3.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.preference:preference:1.1.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation "androidx.webkit:webkit:1.4.0"

    // Google
    implementation platform('com.google.firebase:firebase-bom:26.1.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation "com.google.firebase:firebase-messaging"
    implementation 'com.google.firebase:firebase-crashlytics'
    implementation 'com.google.android.gms:play-services-analytics:17.0.0' // needed for tag manager
    implementation 'com.google.android.gms:play-services-tagmanager:17.0.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation "com.google.code.gson:gson:$gson_version"
    implementation 'com.google.android.gms:play-services-auth:19.0.0'
    implementation 'com.google.android.gms:play-services-base:17.1.0'
    implementation 'com.google.android.gms:play-services-auth-base:17.1.0'
    implementation 'com.google.android.gms:play-services-basement:17.1.0'
    implementation 'com.google.android.gms:play-services-auth-api-phone:17.4.0'
    implementation 'com.huawei.hms:hwid:5.3.0.301'
    // Firebase Performance
    implementation 'com.google.firebase:firebase-perf-ktx'



    // Jumio document scanner
    implementation "com.jumio.android:core:3.6.2@aar"
    implementation "com.jumio.android:nv:3.6.2@aar"
    implementation "com.jumio.android:nv-barcode:3.6.2@aar"
    implementation "com.jumio.android:nv-mrz:3.6.2@aar"
    implementation "com.jumio.android:nv-ocr:3.6.2@aar"
    implementation 'androidx.room:room-runtime:2.3.0' // required by Jumio

    // Misc
    implementation 'com.facebook.android:facebook-login:9.1.1'
    implementation 'com.jakewharton.threetenabp:threetenabp:1.3.1'
    implementation 'com.github.siyamed:android-shape-imageview:0.9.3'
    implementation 'org.apache.commons:commons-lang3:3.12.0'
    // ion
    implementation 'com.koushikdutta.ion:ion:3.1.0'
    implementation 'me.relex:circleindicator:2.1.6'
    implementation 'com.scottyab:rootbeer-lib:0.0.8' // Root detection
    implementation 'com.squareup:android-times-square:1.7.10@aar'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'// Date Picker

    // Unit Tests
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.hamcrest:hamcrest-core:2.2'
    testImplementation 'org.hamcrest:hamcrest-library:2.2'
    testImplementation 'org.hamcrest:hamcrest-integration:1.3'

    //leakcanary
    // debugImplementation because LeakCanary should only run in debug builds.
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'


    // Android JUnit Tests
    androidTestImplementation 'junit:junit:4.13.2'
    implementation 'androidx.annotation:annotation:1.2.0'
    androidTestImplementation 'androidx.annotation:annotation:1.2.0'
    androidTestImplementation 'androidx.test:core:1.3.0'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test:rules:1.3.0'
    androidTestImplementation 'org.hamcrest:hamcrest-library:2.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
    androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
    implementation 'com.huawei.hms:push:5.0.4.302'
    implementation 'com.huawei.hms:hwid:5.0.5.301'
    implementation 'com.huawei.hms:hianalytics:5.0.5.301'
    implementation 'com.huawei.hms:identity:4.0.4.300'
    implementation 'com.huawei.agconnect:agconnect-core:1.5.2.300'
}
apply plugin: 'com.huawei.agconnect'
2 Answers

Thank you for providing the information regarding this issue, Just confirmed by the team, Toolkit has updated the HMS SDK version on which the Convortor depends. You can try to use the Convortor conversion again.

NOTE: If you have any queries, please feel free to contact us. :)

Related