115 lines
3.4 KiB
Plaintext
115 lines
3.4 KiB
Plaintext
import java.util.Properties
|
|
|
|
plugins {
|
|
id("com.android.application")
|
|
}
|
|
|
|
android {
|
|
namespace = "com.example.livestreaming"
|
|
compileSdk = 34
|
|
|
|
signingConfigs {
|
|
create("release") {
|
|
storeFile = file("release-key.jks")
|
|
storePassword = "livestream123"
|
|
keyAlias = "livestream"
|
|
keyPassword = "livestream123"
|
|
}
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId = "com.example.livestreaming"
|
|
minSdk = 21
|
|
targetSdk = 34
|
|
versionCode = 1
|
|
versionName = "1.0"
|
|
|
|
val localProps = Properties().apply {
|
|
val f = rootProject.file("local.properties")
|
|
if (f.exists()) {
|
|
f.inputStream().use { load(it) }
|
|
}
|
|
}
|
|
|
|
val apiBaseUrlEmulator = (localProps.getProperty("api.base_url_emulator")
|
|
?: "http://10.0.2.2:8081/").trim()
|
|
|
|
val apiBaseUrlDevice = (localProps.getProperty("api.base_url_device")
|
|
?: "http://192.168.1.100:8081/").trim()
|
|
|
|
// 模拟器使用服务器地址
|
|
buildConfigField("String", "API_BASE_URL_EMULATOR", "\"$apiBaseUrlEmulator\"")
|
|
// 真机使用服务器地址
|
|
buildConfigField("String", "API_BASE_URL_DEVICE", "\"$apiBaseUrlDevice\"")
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
// 调试版本优化
|
|
isMinifyEnabled = false
|
|
isDebuggable = true
|
|
}
|
|
release {
|
|
// 发布版本优化
|
|
isMinifyEnabled = false
|
|
isShrinkResources = false
|
|
signingConfig = signingConfigs.getByName("release")
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
}
|
|
}
|
|
|
|
// 编译优化
|
|
dexOptions {
|
|
javaMaxHeapSize = "2g"
|
|
preDexLibraries = true
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
buildFeatures {
|
|
viewBinding = true
|
|
buildConfig = true
|
|
}
|
|
|
|
splits {
|
|
abi {
|
|
isEnable = true
|
|
reset()
|
|
include("armeabi-v7a", "arm64-v8a")
|
|
isUniversalApk = true
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation("androidx.core:core:1.12.0")
|
|
implementation("androidx.appcompat:appcompat:1.6.1")
|
|
implementation("com.google.android.material:material:1.11.0")
|
|
implementation("androidx.coordinatorlayout:coordinatorlayout:1.2.0")
|
|
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
|
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
|
|
|
implementation("com.github.bumptech.glide:glide:4.16.0")
|
|
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
|
|
|
|
implementation("com.squareup.retrofit2:retrofit:2.9.0")
|
|
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
|
|
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
|
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
|
|
|
|
val media3Version = "1.2.1"
|
|
implementation("androidx.media3:media3-exoplayer:$media3Version")
|
|
implementation("androidx.media3:media3-exoplayer-hls:$media3Version")
|
|
implementation("androidx.media3:media3-ui:$media3Version")
|
|
|
|
// HTTP-FLV low-latency playback (IjkPlayer via JitPack)
|
|
implementation("com.github.andnux:ijkplayer:0.0.1")
|
|
}
|