Files
pangolin/client/android/app/build.gradle
T
wangjia 126c06833d feat(android): libbox 隧道重写对接真实 1.13.12 API,APK 编译通过(Task 5)
原生层照 PoC 旧/想象 API 写,与真实 sing-box 1.13.12 libbox 差距是架构级:

- 包名 libbox(非 go.libbox);无 BoxService,改 Libbox.setup + CommandServer 模型

- PangolinVpnService 重写:实现完整 PlatformInterface(15法)+CommandServerHandler

- 新增 DefaultNetworkMonitor(上报默认接口,缺则报 no available network)

- openTun 适配真实 TunOptions(RoutePrefixIterator/getMTU/StringBox DNS)

- 统计/切节点经 CommandClient(uplinkTotal/selectOutbound);MainActivity 接线

构建环境矩阵打通:Gradle 8.7(Java21)+声明式插件迁移+AGP 8.6+Kotlin 2.2.0+占位图标

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 19:28:24 +08:00

77 lines
2.2 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace "com.pangolin.pangolin_vpn"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "com.pangolin.pangolin_vpn"
// libbox requires minSdk 21 (gomobile -androidapi 21)
minSdkVersion Math.max(flutter.minSdkVersion as Integer, 21)
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
// ── sing-box libboxgomobile AAR)──────────────────────────────
// 产物由 app/kernel/build-android.sh 生成:
// cd app/kernel && ./build-android.sh
// 路径:client/android/app → ../../.. → repo root → app/kernel/dist/android/
// Kotlin stdlib 由 kotlin-android 插件自动引入,无需显式声明。
def libboxAar = file("${projectDir}/../../../app/kernel/dist/android/libbox.aar")
if (libboxAar.exists()) {
implementation files(libboxAar)
} else {
logger.warn("⚠ libbox.aar not found at ${libboxAar.absolutePath}")
logger.warn(" Run: cd app/kernel && ./build-android.sh")
}
}