2025-09-10 15:35:07 +08:00
|
|
|
group 'com.example.ai_chat_assistant'
|
|
|
|
|
version '1.0-SNAPSHOT'
|
|
|
|
|
|
|
|
|
|
buildscript {
|
|
|
|
|
ext.kotlin_version = '2.1.20'
|
|
|
|
|
repositories {
|
2025-09-10 17:33:26 +08:00
|
|
|
maven { url file("mavenLocal") }
|
2025-09-10 15:35:07 +08:00
|
|
|
google()
|
|
|
|
|
mavenCentral()
|
2025-09-22 11:12:45 +08:00
|
|
|
maven {
|
|
|
|
|
url "https://storage.googleapis.com/download.flutter.io"
|
|
|
|
|
}
|
2025-09-10 15:35:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
classpath 'com.android.tools.build:gradle:8.11.1'
|
|
|
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allprojects {
|
|
|
|
|
repositories {
|
2025-09-10 17:33:26 +08:00
|
|
|
maven { url file("mavenLocal") }
|
2025-09-10 15:35:07 +08:00
|
|
|
google()
|
|
|
|
|
mavenCentral()
|
2025-09-22 11:12:45 +08:00
|
|
|
maven {
|
|
|
|
|
url "https://storage.googleapis.com/download.flutter.io"
|
|
|
|
|
}
|
2025-09-10 15:35:07 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
apply plugin: 'com.android.library'
|
|
|
|
|
apply plugin: 'kotlin-android'
|
|
|
|
|
apply plugin: 'kotlin-kapt'
|
|
|
|
|
|
|
|
|
|
android {
|
|
|
|
|
namespace 'com.example.ai_chat_assistant'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compileSdk 33
|
|
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
|
sourceCompatibility JavaVersion.VERSION_17
|
|
|
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kotlinOptions {
|
|
|
|
|
jvmTarget = "17"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
|
main.java.srcDirs += 'src/main/kotlin'
|
|
|
|
|
test.java.srcDirs += 'src/test/kotlin'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defaultConfig {
|
2025-09-17 15:09:05 +08:00
|
|
|
minSdkVersion 21
|
2025-09-10 15:35:07 +08:00
|
|
|
ndk {
|
|
|
|
|
abiFilters "armeabi-v7a", "arm64-v8a"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildFeatures {
|
|
|
|
|
dataBinding true
|
|
|
|
|
viewBinding = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取配置文件
|
|
|
|
|
def localProperties = new Properties()
|
|
|
|
|
def localPropertiesFile = rootProject.file('local.properties')
|
|
|
|
|
if (localPropertiesFile.exists()) {
|
|
|
|
|
localPropertiesFile.withReader('UTF-8') {
|
|
|
|
|
localProperties.load(it)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取flutter sdk 路径
|
|
|
|
|
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
|
|
|
|
if (flutterRoot == null) {
|
|
|
|
|
throw new GradleException("Flutter SDK not found. Define location with flutter.")
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-22 11:12:45 +08:00
|
|
|
// 找到 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")
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-10 15:35:07 +08:00
|
|
|
repositories {
|
2025-09-17 15:09:05 +08:00
|
|
|
flatDir {
|
|
|
|
|
dirs("libs")
|
|
|
|
|
}
|
2025-09-10 15:35:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dependencies {
|
2025-09-10 17:33:26 +08:00
|
|
|
implementation 'com.alibaba.idst:nui-release:1.0.0'
|
|
|
|
|
implementation 'com.alibaba:fastjson:1.2.83'
|
2025-09-22 11:12:45 +08:00
|
|
|
// 使用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"'
|
2025-09-10 15:35:07 +08:00
|
|
|
// compileOnly files("$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar")
|
2025-09-22 11:12:45 +08:00
|
|
|
compileOnly files(files("libs/flutter.jar"))
|
2025-09-10 17:33:26 +08:00
|
|
|
// implementation(files("libs/fastjson-1.1.46.android.jar"))
|
2025-09-17 15:09:05 +08:00
|
|
|
// implementation(files("libs/nui-release-1.0.0.aar"))
|
2025-09-10 15:35:07 +08:00
|
|
|
}
|
|
|
|
|
}
|