HMS-Core/hms-cordova-plugin

Compile problem on Android Platform

pakdavide opened this issue · 5 comments

Hi all.

I've add this plugin on my Cordova project and now i can't build my app. Below the error message in console.

> Task :app:mergeDebugManifest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugManifest'.

When i remove the plugin, the build work correctly and i can create my apk.
I tryed to install the plugin and then recreate the platform android but the problem persist.

Specification
Cordova: 10.0.0
Cordova-Android: 9.0.0
Gradle: 6.6.1

Thanks in advance

First, I need to know which plugin you are using. (Location, push, etc..?)

For possible solutions:

  1. Check those Huawei repositories, com.huawei.agconnect plugin and library implementation lines have been added to platforms/android/app/build.gradle

  2. If you have these entries then there may be duplicate lines in build.gradle files. In build.gradle files, there shouldn't be any duplicate repository or implementation entry. Check please check platforms/android/build.gradle and platforms/android/app/build.gradle files.

Hi

I'm trying to add the cordova-plugin-hms-push. The plugin work well in the previus version of cordova/gradle/cordova_android but after i update all the stack i encountered the error.

I've checked all file taht you have listed above but there isn't com.huawei.agconnect in any file.

Hi,

I think updating the plugin broke the repositories and agcp plugin classpath. This issue is probably caused by Cordova hooks. For a possible solution, Huawei maven repositories and agcp plugin classpath should be added manually.

Open the platforms/android/build.gradle file and add repositories and agcp plugin. Contents of the file should look similar to the example below:

...

buildscript {
    ...

    repositories {
        /*
            <Other repositories>
        */
        maven { url 'https://developer.huawei.com/repo/' }
    }
    dependencies {
        /*
            <Other dependencies>
        */
        classpath 'com.huawei.agconnect:agcp:1.4.1.300'
    }
    ...
}

/*
    <Other build.gradle entries>
*/

allprojects {
    repositories {
        /*
            <Other repositories>
        */
        maven { url 'https://developer.huawei.com/repo/' }
    }
    ...
}

...

Ok i changed the lines and now it works.

I report that all the configuration were the same exept for the line in dependencies. In my case it was:
dependencies { /* <Other dependencies> */ classpath 'com.huawei.agconnect:agcp:1.1.1.300' }

Maybe this can help you.

Thank you. Agconnect version issue will be fixed on future releases.