Home > other >  com.huawei.agconnect plugin not found
com.huawei.agconnect plugin not found

Time:02-16

So I'm trying to add AppGallery connect gradle plugin to my android project using new Kotlin DSL syntax. But I'm getting error like this:

org.gradle.internal.exceptions.LocationAwareException: Build file 'D:\#KERJAAN\devbase\sample\build.gradle.kts' line: 3
Plugin [id: 'com.huawei.agconnect', version: '1.6.3.300'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.huawei.agconnect:com.huawei.agconnect.gradle.plugin:1.6.3.300')
  Searched in the following repositories:
    Gradle Central Plugin Repository
    Google
    MavenRepo
    maven(https://developer.huawei.com/repo/)

What i did was adding repository for plugin like this in settings.gradle.kts:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
        maven { setUrl("https://developer.huawei.com/repo/") }
    }
}

And adding the plugin like this in app's build.gradle.kts:

plugins {
   id("com.huawei.agconnect") version "1.6.3.300"
}

Interestingly, It works if using classpath from the root build.gradle.kts. Does anyone know why?

CodePudding user response:

This issue is caused by the integration configuration of AppGallery Connect. I do not know which service of the HMS Core you integrated, but the procedures for configuring AppGallery Connect and integrating the HMS Core SDK are similar.

Take the enter image description here

enter image description here

enter image description here

You could also refer to the Sample Code for integrating AGCP Kotlin in enter image description here

enter image description here

Please refer to each step of the document to re-integrate. If you have any questions during the process, feel free to contact us.

CodePudding user response:

Any Gradle plugin (this is not AGC specific at all) can only be loaded at the root project level, and then usually be applied on the module level. Based on other examples, the explicit Kotlin syntax might be id("com.huawei.agconnect").version("1.6.3.300").

  • Related