HarmonyOS 鸿蒙Next Failed to apply plugin 'com.huawei.agconnect'
HarmonyOS 鸿蒙Next Failed to apply plugin 'com.huawei.agconnect’
> Failed to apply plugin ‘com.huawei.agconnect’.
项目build.Gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
//增加Android Gradle插件版本号配置,{version}为实际的Gradle插件版本号,例如7.3.1。
classpath ‘com.android.tools.build:gradle:{7.3.0}’
//增加AGC插件配置,请您参见AGC插件依赖关系选择合适的AGC插件版本。
classpath ‘com.huawei.agconnect:agcp:1.9.1.301’
}
}
plugins {
id ‘com.android.application’ version ‘7.3.0’ apply false
id ‘com.android.library’ version ‘7.3.0’ apply false
} 应用build.gradle:
plugins {
id ‘com.android.application’
id ‘com.huawei.agconnect’
}
android {
namespace ‘com.daimeimei.daimeimei’
compileSdk 32
defaultConfig {
applicationId "com.daimeimei.daimeimei"
minSdk 28
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.navigation:navigation-fragment:2.4.1'
implementation 'androidx.navigation:navigation-ui:2.4.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.huawei.agconnect:agconnect-core:1.9.1.301'
implementation 'com.huawei.agconnect:agconnect-auth:1.9.1.301'
implementation 'com.huawei.agconnect:agconnect-remoteconfig:1.9.1.301'
implementation 'com.huawei.agconnect:agconnect-function:1.9.1.301'
implementation 'com.huawei.agconnect:agconnect-cloud-database:1.9.1.301'
implementation 'com.huawei.agconnect:agconnect-applinking:1.9.1.301'
implementation 'com.huawei.agconnect:agconnect-crash:1.9.1.301'
implementation 'com.huawei.agconnect:agconnect-apms:1.6.2.300'
implementation "com.huawei.agconnect:agconnect-storage:1.9.1.301"
implementation 'com.huawei.agconnect:agconnect-appmessaging:1.9.1.301'
}
settings.gradle:
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven { url “https://maven.aliyun.com/repository/public” }
maven { url “https://maven.aliyun.com/repository/central” }
maven { url “https://maven.aliyun.com/repository/jcenter” }
maven { url “https://maven.aliyun.com/repository/google” }
maven { url “https://maven.aliyun.com/repository” }
maven { url “https://maven.aliyun.com/repository/gradle-plugin” }
maven { url ‘https://developer.huawei.com/repo/’ }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url “https://maven.aliyun.com/repository/public” }
maven { url “https://maven.aliyun.com/repository/central” }
maven { url “https://maven.aliyun.com/repository/jcenter” }
maven { url “https://maven.aliyun.com/repository/google” }
maven { url “https://maven.aliyun.com/repository” }
maven { url “https://maven.aliyun.com/repository/gradle-plugin” }
maven { url ‘https://developer.huawei.com/repo/’ }
}
}
rootProject.name = “Daimeimei”
include ‘:app’
更多关于HarmonyOS 鸿蒙Next Failed to apply plugin 'com.huawei.agconnect'的实战教程也可以访问 https://www.itying.com/category-93-b0.html
更多关于HarmonyOS 鸿蒙Next Failed to apply plugin 'com.huawei.agconnect'的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
出现HarmonyOS鸿蒙开发中“Failed to apply plugin ‘com.huawei.agconnect’”的问题,通常是因为插件配置不正确或缺失必要的依赖。请检查以下几点:
- 确保在项目的
build.gradle文件中已正确添加了对com.huawei.agconnect插件的依赖和配置。 - 检查是否有网络问题导致插件无法下载或更新。
- 查看是否所有必需的SDK和库都已更新到兼容版本。
- 清理并重新构建项目。
如果问题依旧没法解决请加我微信,我的微信是itying888。
更多关于HarmonyOS 鸿蒙Next Failed to apply plugin 'com.huawei.agconnect'的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html

