feat:plugin编译为aar包引用
This commit is contained in:
@@ -7,6 +7,9 @@ buildscript {
|
|||||||
maven { url file("mavenLocal") }
|
maven { url file("mavenLocal") }
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
url "https://storage.googleapis.com/download.flutter.io"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -20,6 +23,9 @@ allprojects {
|
|||||||
maven { url file("mavenLocal") }
|
maven { url file("mavenLocal") }
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
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.")
|
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 {
|
repositories {
|
||||||
flatDir {
|
flatDir {
|
||||||
dirs("libs")
|
dirs("libs")
|
||||||
@@ -83,7 +100,12 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.alibaba.idst:nui-release:1.0.0'
|
implementation 'com.alibaba.idst:nui-release:1.0.0'
|
||||||
implementation 'com.alibaba:fastjson:1.2.83'
|
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("$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/fastjson-1.1.46.android.jar"))
|
||||||
// implementation(files("libs/nui-release-1.0.0.aar"))
|
// implementation(files("libs/nui-release-1.0.0.aar"))
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
BIN
android/libs/flutter.jar
Normal file
BIN
android/libs/flutter.jar
Normal file
Binary file not shown.
@@ -50,3 +50,11 @@ android {
|
|||||||
flutter {
|
flutter {
|
||||||
source = "../.."
|
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))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
val mavenLocalPath = rootProject.file("../../android/mavenLocal")
|
val mavenLocalPath = rootProject.file("../../android/mavenLocal")
|
||||||
println("Maven local path: ${mavenLocalPath.absolutePath}")
|
// println("Maven local path: ${mavenLocalPath.absolutePath}")
|
||||||
println("Maven local exists: ${mavenLocalPath.exists()}")
|
// println("Maven local exists: ${mavenLocalPath.exists()}")
|
||||||
|
|
||||||
maven { url = uri(mavenLocalPath) }
|
maven { url = uri(mavenLocalPath) }
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
BIN
example/android/libs/ai_assistant_plugin-release.aar
Normal file
BIN
example/android/libs/ai_assistant_plugin-release.aar
Normal file
Binary file not shown.
@@ -19,6 +19,8 @@ pluginManagement {
|
|||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
|
||||||
|
flatDir { dirs(file("libs")) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user