diff --git a/android/build.gradle b/android/build.gradle
index dd5e36a..e049049 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -7,6 +7,9 @@ buildscript {
maven { url file("mavenLocal") }
google()
mavenCentral()
+ maven {
+ url "https://storage.googleapis.com/download.flutter.io"
+ }
}
dependencies {
@@ -20,6 +23,9 @@ allprojects {
maven { url file("mavenLocal") }
google()
mavenCentral()
+ maven {
+ url "https://storage.googleapis.com/download.flutter.io"
+ }
}
}
@@ -74,6 +80,17 @@ android {
throw new GradleException("Flutter SDK not found. Define location with flutter.")
}
+ // 找到 flutter.jar 文件
+ def flutterJar = new File(flutterRoot, "bin/cache/artifacts/engine/android-arm/flutter.jar")
+ if (!flutterJar.exists()) {
+ // 尝试其他路径
+ flutterJar = new File(flutterRoot, "bin/cache/artifacts/engine/android-arm-release/flutter.jar")
+ }
+ if (!flutterJar.exists()) {
+ // Windows 上可能在这个位置
+ flutterJar = new File(flutterRoot, "bin/cache/artifacts/engine/android-x64/flutter.jar")
+ }
+
repositories {
flatDir {
dirs("libs")
@@ -83,7 +100,12 @@ android {
dependencies {
implementation 'com.alibaba.idst:nui-release:1.0.0'
implementation 'com.alibaba:fastjson:1.2.83'
+ // 使用Flutter的官方Maven依赖
+ // compileOnly 'io.flutter:flutter_embedding_debug:1.0.0-3.27.4'
+ // 或者使用release版本
+ // compileOnly '"io.flutter:flutter_embedding_release:1.0.0-de555ebd6cfe3e606a101b9ae45bbf5e62d4e4e1"'
// compileOnly files("$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar")
+ compileOnly files(files("libs/flutter.jar"))
// implementation(files("libs/fastjson-1.1.46.android.jar"))
// implementation(files("libs/nui-release-1.0.0.aar"))
}
diff --git a/android/build/reports/problems/problems-report.html b/android/build/reports/problems/problems-report.html
index 30af9b7..807dc26 100644
--- a/android/build/reports/problems/problems-report.html
+++ b/android/build/reports/problems/problems-report.html
@@ -650,7 +650,7 @@ code + .copy-button {
diff --git a/android/libs/flutter.jar b/android/libs/flutter.jar
new file mode 100644
index 0000000..6a783f8
Binary files /dev/null and b/android/libs/flutter.jar differ
diff --git a/example/android/app/build.gradle.kts b/example/android/app/build.gradle.kts
index 498f87f..abc64d9 100644
--- a/example/android/app/build.gradle.kts
+++ b/example/android/app/build.gradle.kts
@@ -50,3 +50,11 @@ android {
flutter {
source = "../.."
}
+
+dependencies {
+ // Process .aar files in the libs folder.
+ val aarFiles = fileTree(mapOf("dir" to "$rootDir/libs", "include" to listOf("*.aar")))
+ aarFiles.forEach { aar ->
+ implementation(files(aar))
+ }
+}
\ No newline at end of file
diff --git a/example/android/build.gradle.kts b/example/android/build.gradle.kts
index 4a3c37d..3ef5e4e 100644
--- a/example/android/build.gradle.kts
+++ b/example/android/build.gradle.kts
@@ -1,8 +1,8 @@
allprojects {
repositories {
val mavenLocalPath = rootProject.file("../../android/mavenLocal")
- println("Maven local path: ${mavenLocalPath.absolutePath}")
- println("Maven local exists: ${mavenLocalPath.exists()}")
+// println("Maven local path: ${mavenLocalPath.absolutePath}")
+// println("Maven local exists: ${mavenLocalPath.exists()}")
maven { url = uri(mavenLocalPath) }
diff --git a/example/android/build/reports/problems/problems-report.html b/example/android/build/reports/problems/problems-report.html
index fd2eaf0..8d897b7 100644
--- a/example/android/build/reports/problems/problems-report.html
+++ b/example/android/build/reports/problems/problems-report.html
@@ -650,7 +650,7 @@ code + .copy-button {
diff --git a/example/android/libs/ai_assistant_plugin-release.aar b/example/android/libs/ai_assistant_plugin-release.aar
new file mode 100644
index 0000000..f32e372
Binary files /dev/null and b/example/android/libs/ai_assistant_plugin-release.aar differ
diff --git a/example/android/settings.gradle.kts b/example/android/settings.gradle.kts
index 1f4edca..1eb7419 100644
--- a/example/android/settings.gradle.kts
+++ b/example/android/settings.gradle.kts
@@ -19,6 +19,8 @@ pluginManagement {
google()
mavenCentral()
gradlePluginPortal()
+
+ flatDir { dirs(file("libs")) }
}
}