162 lines
4.8 KiB
Groovy
Executable File
162 lines
4.8 KiB
Groovy
Executable File
plugins {
|
||
id "com.android.application"
|
||
id "kotlin-android"
|
||
id "dev.flutter.flutter-gradle-plugin"
|
||
}
|
||
|
||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
||
def properties = new Properties()
|
||
|
||
assert localPropertiesFile.exists()
|
||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
||
|
||
def flutterRoot = properties.getProperty("flutter.sdk")
|
||
assert flutterRoot != null, "flutter.sdk not set in local.properties"
|
||
|
||
boolean hasKeyStore = false
|
||
|
||
def keystoreProperties = new Properties()
|
||
def keystorePropertiesFile = rootProject.file('key.properties')
|
||
if (keystorePropertiesFile.exists()) {
|
||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||
hasKeyStore = true
|
||
} else {
|
||
println "+++"
|
||
println "No keystore defined. The app will not be signed."
|
||
println "Create a android/key.properties file with the following properties:"
|
||
println "storePassword"
|
||
println "keyPassword"
|
||
println "keyAlias"
|
||
println "storeFile"
|
||
println "+++"
|
||
}
|
||
|
||
def flutterVersionCode = properties.getProperty('flutter.versionCode')?: '1'
|
||
|
||
def flutterVersionName = properties.getProperty('flutter.versionName') ?: '1.0'
|
||
|
||
android {
|
||
namespace 'com.hiddify.hiddify'
|
||
testNamespace "test.com.hiddify.hiddify"
|
||
compileSdk 36
|
||
ndkVersion "26.1.10909125"
|
||
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_17
|
||
targetCompatibility JavaVersion.VERSION_17
|
||
}
|
||
|
||
kotlinOptions {
|
||
jvmTarget = '17'
|
||
}
|
||
|
||
sourceSets {
|
||
main.java.srcDirs += 'src/main/kotlin'
|
||
}
|
||
|
||
defaultConfig {
|
||
applicationId "app.hifastvpn.com"
|
||
minSdkVersion flutter.minSdkVersion
|
||
targetSdkVersion 34
|
||
versionCode flutterVersionCode.toInteger()
|
||
versionName flutterVersionName
|
||
multiDexEnabled true
|
||
manifestPlaceholders = [
|
||
'android.permission.ACCESS_NETWORK_STATE': true,
|
||
'OPENINSTALL_APPKEY' : "alf57p",
|
||
]
|
||
android.defaultConfig.manifestPlaceholders += [
|
||
'android:screenOrientation': "portrait"
|
||
]
|
||
}
|
||
|
||
splits {
|
||
abi {
|
||
enable true
|
||
reset()
|
||
include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
|
||
universalApk true
|
||
}
|
||
}
|
||
|
||
if (hasKeyStore) {
|
||
signingConfigs {
|
||
release {
|
||
/* keyAlias keystoreProperties['keyAlias']
|
||
keyPassword keystoreProperties['keyPassword']
|
||
storeFile file(keystoreProperties['storeFile'])
|
||
storePassword keystoreProperties['storePassword']*/
|
||
storeFile file("upload-keystore.jks")
|
||
storePassword "123456"
|
||
keyAlias "upload"
|
||
keyPassword "123456"
|
||
}
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
if (hasKeyStore) {
|
||
signingConfig signingConfigs.release
|
||
} else {
|
||
signingConfig signingConfigs.debug
|
||
}
|
||
ndk {
|
||
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
|
||
debugSymbolLevel 'FULL'
|
||
}
|
||
// 禁用代码混淆和资源压缩,解决VPN连接问题
|
||
minifyEnabled false
|
||
shrinkResources false
|
||
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||
}
|
||
}
|
||
|
||
buildFeatures {
|
||
viewBinding true
|
||
aidl true
|
||
}
|
||
|
||
configurations.all {
|
||
resolutionStrategy {
|
||
force "org.jetbrains.kotlin:kotlin-stdlib:2.1.0"
|
||
force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.0"
|
||
force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.0"
|
||
force "androidx.annotation:annotation-jvm:1.7.0"
|
||
}
|
||
}
|
||
|
||
lintOptions {
|
||
checkReleaseBuilds false
|
||
}
|
||
}
|
||
|
||
android.applicationVariants.all { variant ->
|
||
variant.outputs.each { output ->
|
||
output.versionCodeOverride = android.defaultConfig.versionCode
|
||
}
|
||
}
|
||
|
||
flutter {
|
||
source '../..'
|
||
}
|
||
|
||
dependencies {
|
||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||
implementation 'com.google.code.gson:gson:2.10.1'
|
||
implementation 'androidx.core:core-ktx:1.12.0'
|
||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
|
||
implementation "org.jetbrains.kotlin:kotlin-stdlib:2.1.0"
|
||
implementation "androidx.annotation:annotation:1.7.1"
|
||
implementation 'com.google.android.material:material:1.9.0'
|
||
constraints {
|
||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.0") {
|
||
because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
|
||
}
|
||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.0") {
|
||
because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
|
||
}
|
||
}
|
||
}
|