fix(mobile): 让华为 AGConnect 在 AGP 9 下能识别真实配置

放入 agconnect-services.json 后原插件坐标无法解析,且 1.9.1 不兼容 AGP 9。
映射到 agcp 1.9.5.301,Gradle 可按包名校验;该文件继续忽略不入库。

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
编码工程师
2026-08-31 00:56:12 +08:00
co-authored by Cursor multica-agent
parent a71f6a0ce1
commit 1d393f4f1e
10 changed files with 88 additions and 29 deletions
+19 -2
View File
@@ -1,3 +1,19 @@
buildscript {
repositories {
maven("https://maven.aliyun.com/repository/google")
maven("https://maven.aliyun.com/repository/central")
maven("https://developer.huawei.com/repo/")
google()
mavenCentral()
}
// agcp 1.9.x 用 apply() 时会检查 buildscript classpath 里有没有 AGP
// 仅靠 plugins DSL 会报「com.android.tools.build:gradle is no set」。
dependencies {
classpath("com.android.tools.build:gradle:9.0.1")
classpath("com.huawei.agconnect:agcp:1.9.5.301")
}
}
plugins {
id("com.android.application")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
@@ -6,8 +22,9 @@ plugins {
// 华为 agconnect-services.json 到位后才启用 AGConnect 插件,避免缺文件时整包编不过。
// 文件从华为 AppGallery Connect 下载,放到本目录,不要提交进 Git。
val agconnectServices = file("agconnect-services.json")
if (agconnectServices.exists()) {
// jpush_flutter_android 只在自己的 library 模块 apply 该插件,不会处理本 app 的配置文件,
// 所以这里仍要在 :app 上 apply,并不是重复。
if (file("agconnect-services.json").exists()) {
apply(plugin = "com.huawei.agconnect")
}