zhibo/android-app/app/build.gradle.kts

135 lines
4.7 KiB
Plaintext
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.

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) }
}
}
// ============ 主API地址普通业务功能============
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.164:8081/").trim()
buildConfigField("String", "API_BASE_URL_EMULATOR", "\"$apiBaseUrlEmulator\"")
buildConfigField("String", "API_BASE_URL_DEVICE", "\"$apiBaseUrlDevice\"")
// ============ 直播/通话服务地址(始终远程)============
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\"")
}
buildTypes {
debug {
// 调试版本优化
isMinifyEnabled = false
isDebuggable = true
}
release {
// 发布版本优化
isMinifyEnabled = false
isShrinkResources = false
signingConfig = signingConfigs.getByName("release")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
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("androidx.viewpager2:viewpager2:1.0.0")
implementation("com.github.bumptech.glide:glide:4.16.0")
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
// SVG支持
implementation("com.caverock:androidsvg-aar:1.4")
implementation("de.hdodenhof:circleimageview:3.1.0")
// FlexboxLayout for message reactions
implementation("com.google.android.flexbox:flexbox:3.0.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")
// GSYVideoPlayer - 支持多内核的视频播放器IjkPlayer/ExoPlayer
// 用于FLV低延迟直播播放已内置IjkPlayer
implementation("com.github.CarGuo.GSYVideoPlayer:GSYVideoPlayer:v8.6.0-release-jitpack")
// WebRTC for voice/video calls
// 使用 Google 官方 WebRTC 库
implementation("io.getstream:stream-webrtc-android:1.1.1")
// RTMP 推流 SDK手机开播- RootEncoder 2.2.2
implementation("com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:2.2.2")
}