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:
co-authored by
Cursor
multica-agent
parent
a71f6a0ce1
commit
1d393f4f1e
+1
-1
@@ -41,7 +41,7 @@ flutter build apk --release \
|
||||
| `livekitUrl` | LiveKit 语音通话 | `wss://jxd.jinniu.ink/livekit` |
|
||||
| `authApiBase` | 公司账号登录后端 | `https://jxd.jinniu.ink/account` |
|
||||
|
||||
华为厂商通道还缺 `android/app/agconnect-services.json`,取得方式见同目录 `README-agconnect.md`。不要把该文件提交进 Git。
|
||||
华为厂商通道需要本地放置 `android/app/agconnect-services.json`(与包名 `cn.solsum.jinxunda` 对应),取得方式见 `android/app/README-agconnect.md`。不要把该文件提交进 Git。
|
||||
|
||||
## 登录接口契约(后端:任务 B-60 account-service,已上线)
|
||||
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
analyzer:
|
||||
exclude:
|
||||
- build/**
|
||||
- android/**
|
||||
- ios/**
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 华为厂商通道配置文件(缺口)
|
||||
# 华为厂商通道配置文件
|
||||
|
||||
华为通道客户端其余依赖已接入。**唯一还缺的文件**是:
|
||||
华为通道客户端依赖已接入。构建机需要一份本地文件:
|
||||
|
||||
`mobile/android/app/agconnect-services.json`
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
|
||||
没有这份文件时:
|
||||
|
||||
- 安卓包仍可构建(AGConnect 插件按文件是否存在条件启用)
|
||||
- 极光自己的通道仍可初始化
|
||||
- AGConnect 插件不会启用,安卓包仍可走极光自有通道构建
|
||||
- **华为真机的厂商通道无法接通**,杀进程后的到达率会明显下降
|
||||
|
||||
本阶段不伪造、不提交该文件。
|
||||
放入真实配置后,`:app` 会启用 AGConnect(agcp `1.9.5.301`,适配 AGP 9)。Gradle 会按包名 `cn.solsum.jinxunda` 校验该文件;校验失败则构建失败。
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[versions]
|
||||
agp = "9.0.1"
|
||||
agcp = "1.9.5.301"
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
huawei-agconnect = { id = "com.huawei.agconnect", version.ref = "agcp" }
|
||||
@@ -20,13 +20,24 @@ pluginManagement {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
// 华为插件发布在 Maven 的 agcp 构件上,没有 Plugin Portal 的
|
||||
// com.huawei.agconnect.gradle.plugin 坐标。plugins DSL 必须映射过去,
|
||||
// 否则放入 agconnect-services.json 后启用插件会解析失败。
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
if (requested.id.id == "com.huawei.agconnect") {
|
||||
useModule("com.huawei.agconnect:agcp:1.9.5.301")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||
id("com.android.application") version "9.0.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.3.20" apply false
|
||||
id("com.huawei.agconnect") version "1.9.1.301" apply false
|
||||
id("com.huawei.agconnect") version "1.9.5.301" apply false
|
||||
}
|
||||
|
||||
include(":app")
|
||||
|
||||
+26
-10
@@ -369,10 +369,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: intl
|
||||
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
|
||||
sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.20.2"
|
||||
version: "0.20.3"
|
||||
jni:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -397,6 +397,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
jpush_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: jpush_flutter
|
||||
sha256: "5dcfcd553787db0c92a9b2f0898a6dbc053530c6636ed488416cd9edf12f08d3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.5.6"
|
||||
jpush_flutter_android:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: jpush_flutter_android
|
||||
sha256: d2bae547aefb2ff5acf28badaf115bb358e9244b6acef84625d8db0228bbc0b2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -489,10 +505,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
|
||||
sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.19"
|
||||
version: "0.12.20"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -505,10 +521,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
|
||||
sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.18.0"
|
||||
version: "1.19.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -902,10 +918,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
|
||||
sha256: "2a122cbe059f8b610d3a5415f42e255b6c17b1f21eee1d960f31080237fb4f11"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.11"
|
||||
version: "0.7.12"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -926,10 +942,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
|
||||
sha256: f36f9f3be64c6198714492bb455c11056e33e2f85d9a0b676a48301e44fdcf47
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "2.4.2"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user