2025-12-21 17:32:12 +08:00
|
|
|
|
import java.util.Properties
|
|
|
|
|
|
|
2025-12-16 15:47:36 +08:00
|
|
|
|
plugins {
|
|
|
|
|
|
id("com.android.application")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
android {
|
|
|
|
|
|
namespace = "com.example.livestreaming"
|
|
|
|
|
|
compileSdk = 34
|
|
|
|
|
|
|
2025-12-21 17:32:12 +08:00
|
|
|
|
signingConfigs {
|
|
|
|
|
|
create("release") {
|
|
|
|
|
|
storeFile = file("release-key.jks")
|
|
|
|
|
|
storePassword = "livestream123"
|
|
|
|
|
|
keyAlias = "livestream"
|
|
|
|
|
|
keyPassword = "livestream123"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-16 15:47:36 +08:00
|
|
|
|
defaultConfig {
|
|
|
|
|
|
applicationId = "com.example.livestreaming"
|
|
|
|
|
|
minSdk = 21
|
|
|
|
|
|
targetSdk = 34
|
|
|
|
|
|
versionCode = 1
|
|
|
|
|
|
versionName = "1.0"
|
|
|
|
|
|
|
2025-12-21 17:32:12 +08:00
|
|
|
|
val localProps = Properties().apply {
|
|
|
|
|
|
val f = rootProject.file("local.properties")
|
|
|
|
|
|
if (f.exists()) {
|
|
|
|
|
|
f.inputStream().use { load(it) }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-31 14:44:51 +08:00
|
|
|
|
// ============ 主API地址(普通业务功能)============
|
2025-12-21 17:32:12 +08:00
|
|
|
|
val apiBaseUrlEmulator = (localProps.getProperty("api.base_url_emulator")
|
2025-12-21 18:55:17 +08:00
|
|
|
|
?: "http://10.0.2.2:8081/").trim()
|
2025-12-21 17:32:12 +08:00
|
|
|
|
val apiBaseUrlDevice = (localProps.getProperty("api.base_url_device")
|
2025-12-24 18:11:39 +08:00
|
|
|
|
?: "http://192.168.1.164:8081/").trim()
|
2025-12-21 17:32:12 +08:00
|
|
|
|
|
|
|
|
|
|
buildConfigField("String", "API_BASE_URL_EMULATOR", "\"$apiBaseUrlEmulator\"")
|
|
|
|
|
|
buildConfigField("String", "API_BASE_URL_DEVICE", "\"$apiBaseUrlDevice\"")
|
2025-12-31 14:44:51 +08:00
|
|
|
|
|
|
|
|
|
|
// ============ 直播/通话服务地址(始终远程)============
|
|
|
|
|
|
val liveServerHost = (localProps.getProperty("live.server_host") ?: "1.15.149.240").trim()
|
|
|
|
|
|
val liveServerPort = (localProps.getProperty("live.server_port") ?: "8083").trim()
|
|
|
|
|
|
val turnServerHost = (localProps.getProperty("turn.server_host") ?: "1.15.149.240").trim()
|
|
|
|
|
|
val turnServerPort = (localProps.getProperty("turn.server_port") ?: "3478").trim()
|
|
|
|
|
|
|
|
|
|
|
|
buildConfigField("String", "LIVE_SERVER_HOST", "\"$liveServerHost\"")
|
|
|
|
|
|
buildConfigField("String", "LIVE_SERVER_PORT", "\"$liveServerPort\"")
|
|
|
|
|
|
buildConfigField("String", "TURN_SERVER_HOST", "\"$turnServerHost\"")
|
|
|
|
|
|
buildConfigField("String", "TURN_SERVER_PORT", "\"$turnServerPort\"")
|
2025-12-16 15:47:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buildTypes {
|
2025-12-17 17:23:54 +08:00
|
|
|
|
debug {
|
|
|
|
|
|
// 调试版本优化
|
2025-12-16 15:47:36 +08:00
|
|
|
|
isMinifyEnabled = false
|
2025-12-17 17:23:54 +08:00
|
|
|
|
isDebuggable = true
|
|
|
|
|
|
}
|
|
|
|
|
|
release {
|
|
|
|
|
|
// 发布版本优化
|
2025-12-21 17:32:12 +08:00
|
|
|
|
isMinifyEnabled = false
|
|
|
|
|
|
isShrinkResources = false
|
|
|
|
|
|
signingConfig = signingConfigs.getByName("release")
|
2025-12-16 15:47:36 +08:00
|
|
|
|
proguardFiles(
|
|
|
|
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
|
|
|
|
"proguard-rules.pro"
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
compileOptions {
|
2026-01-05 16:58:39 +08:00
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
|
|
|
|
targetCompatibility = JavaVersion.VERSION_21
|
2025-12-16 15:47:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buildFeatures {
|
|
|
|
|
|
viewBinding = true
|
|
|
|
|
|
buildConfig = true
|
|
|
|
|
|
}
|
2025-12-21 17:32:12 +08:00
|
|
|
|
|
|
|
|
|
|
splits {
|
|
|
|
|
|
abi {
|
|
|
|
|
|
isEnable = true
|
|
|
|
|
|
reset()
|
|
|
|
|
|
include("armeabi-v7a", "arm64-v8a")
|
|
|
|
|
|
isUniversalApk = true
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-16 15:47:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
implementation("androidx.core:core:1.12.0")
|
|
|
|
|
|
implementation("androidx.appcompat:appcompat:1.6.1")
|
|
|
|
|
|
implementation("com.google.android.material:material:1.11.0")
|
2025-12-17 15:38:00 +08:00
|
|
|
|
implementation("androidx.coordinatorlayout:coordinatorlayout:1.2.0")
|
2025-12-16 15:47:36 +08:00
|
|
|
|
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
|
|
|
|
|
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
2025-12-17 15:38:00 +08:00
|
|
|
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
2025-12-24 17:43:14 +08:00
|
|
|
|
implementation("androidx.viewpager2:viewpager2:1.0.0")
|
2025-12-17 15:38:00 +08:00
|
|
|
|
|
|
|
|
|
|
implementation("com.github.bumptech.glide:glide:4.16.0")
|
|
|
|
|
|
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
|
2026-01-04 19:00:02 +08:00
|
|
|
|
|
|
|
|
|
|
// SVG支持
|
|
|
|
|
|
implementation("com.caverock:androidsvg-aar:1.4")
|
2025-12-16 15:47:36 +08:00
|
|
|
|
|
2025-12-24 18:11:39 +08:00
|
|
|
|
implementation("de.hdodenhof:circleimageview:3.1.0")
|
|
|
|
|
|
|
2025-12-29 18:02:28 +08:00
|
|
|
|
// FlexboxLayout for message reactions
|
|
|
|
|
|
implementation("com.google.android.flexbox:flexbox:3.0.0")
|
|
|
|
|
|
|
2025-12-16 15:47:36 +08:00
|
|
|
|
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")
|
2025-12-21 17:32:12 +08:00
|
|
|
|
|
2026-01-04 20:50:37 +08:00
|
|
|
|
// GSYVideoPlayer - 支持多内核的视频播放器(IjkPlayer/ExoPlayer)
|
|
|
|
|
|
// 用于FLV低延迟直播播放,已内置IjkPlayer
|
|
|
|
|
|
implementation("com.github.CarGuo.GSYVideoPlayer:GSYVideoPlayer:v8.6.0-release-jitpack")
|
2025-12-30 16:08:43 +08:00
|
|
|
|
|
|
|
|
|
|
// WebRTC for voice/video calls
|
|
|
|
|
|
// 使用 Google 官方 WebRTC 库
|
|
|
|
|
|
implementation("io.getstream:stream-webrtc-android:1.1.1")
|
2026-01-03 12:24:05 +08:00
|
|
|
|
|
|
|
|
|
|
// RTMP 推流 SDK(手机开播)- RootEncoder 2.2.2
|
|
|
|
|
|
implementation("com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:2.2.2")
|
2025-12-16 15:47:36 +08:00
|
|
|
|
}
|