放入 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>
44 lines
1.6 KiB
Kotlin
44 lines
1.6 KiB
Kotlin
pluginManagement {
|
|
val flutterSdkPath =
|
|
run {
|
|
val properties = java.util.Properties()
|
|
file("local.properties").inputStream().use { properties.load(it) }
|
|
val flutterSdkPath = properties.getProperty("flutter.sdk")
|
|
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
|
|
flutterSdkPath
|
|
}
|
|
|
|
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
|
|
|
repositories {
|
|
// 国内镜像优先(本网络 maven.google.com 不可达)
|
|
maven("https://maven.aliyun.com/repository/google")
|
|
maven("https://maven.aliyun.com/repository/central")
|
|
maven("https://maven.aliyun.com/repository/gradle-plugin")
|
|
maven("https://developer.huawei.com/repo/")
|
|
google()
|
|
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.5.301" apply false
|
|
}
|
|
|
|
include(":app")
|