1. OkHttp 3.14.9 -> 3.12.0(Android10Platform 引用 Android 10+ API 导致 VerifyError) 2. Gson 2.10.1 -> 2.8.6(ReflectionHelper 引用 Java 9+ API 导致 VerifyError) 3. Retrofit 2.9.0 -> 2.6.0(与客户环境一致,配合 OkHttp 3.12.0) 4. Coroutines 1.7.3 -> 1.6.4(1.7+ 要求 minSdk 21) 5. 移除 ExoPlayer 2.19.1,改用系统原生 MediaPlayer + SurfaceView 6. 主题 MaterialComponents -> AppCompat(避免 MaterialComponentsViewInflater multidex 问题) 7. multidex-config.pro 新增 kotlinx.coroutines.** 和 retrofit2.** 到主 dex 8. 新增 Android 4.2 兼容性改动文档
114 lines
3.9 KiB
Groovy
114 lines
3.9 KiB
Groovy
plugins {
|
||
id 'com.android.application'
|
||
id 'org.jetbrains.kotlin.android'
|
||
}
|
||
|
||
android {
|
||
namespace 'com.pukka.mediaapp'
|
||
compileSdk 34
|
||
|
||
defaultConfig {
|
||
applicationId "com.pukka.mediaapp.partnertest"
|
||
minSdk 17
|
||
targetSdk 29
|
||
versionCode 1
|
||
versionName "1.0"
|
||
multiDexEnabled true
|
||
multiDexKeepProguard file('multidex-config.pro')
|
||
|
||
ndk {
|
||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
minifyEnabled false
|
||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||
}
|
||
}
|
||
|
||
buildFeatures {
|
||
viewBinding true
|
||
buildConfig true
|
||
}
|
||
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_17
|
||
targetCompatibility JavaVersion.VERSION_17
|
||
}
|
||
|
||
kotlinOptions {
|
||
jvmTarget = '17'
|
||
}
|
||
|
||
sourceSets {
|
||
main {
|
||
jniLibs.srcDirs = ['libs']
|
||
}
|
||
}
|
||
|
||
packagingOptions {
|
||
jniLibs {
|
||
useLegacyPackaging = true
|
||
}
|
||
resources {
|
||
excludes += ['META-INF/DEPENDENCIES', 'META-INF/LICENSE', 'META-INF/LICENSE.txt', 'META-INF/license.txt', 'META-INF/NOTICE', 'META-INF/NOTICE.txt', 'META-INF/notice.txt', 'META-INF/ASL2.0', 'META-INF/*.kotlin_module']
|
||
}
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
// Kotlin & AndroidX
|
||
implementation 'androidx.core:core-ktx:1.12.0'
|
||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||
implementation 'com.google.android.material:material:1.11.0'
|
||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||
implementation 'androidx.recyclerview:recyclerview:1.3.2'
|
||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
|
||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
|
||
implementation 'androidx.activity:activity-ktx:1.3.1'
|
||
|
||
// multidex
|
||
implementation 'androidx.multidex:multidex:2.0.1'
|
||
|
||
// Retrofit 2.6.0 + OkHttp 3.12.0(与客户环境一致,兼容 Android 4.x)
|
||
// Retrofit 2.6.0 自然依赖 OkHttp 3.12.0(无 Android10Platform,不会 VerifyError)
|
||
// OkHttp 3.12.1+ 包含 Android10Platform,引用 Android 10+ API,在 Android 4.x 上 VerifyError
|
||
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
|
||
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
|
||
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
|
||
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0'
|
||
|
||
// Gson 2.8.6(2.9+ 引入 ReflectionHelper,引用 Java 9+ API,在 Android 4.x 上 VerifyError)
|
||
implementation 'com.google.code.gson:gson:2.8.6'
|
||
|
||
// Coroutines 1.6.4(1.7+ 要求 minSdk 21,1.6.4 兼容 API 16+)
|
||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
|
||
|
||
// JetsenxSdk + NewTVSDK
|
||
implementation files('libs/JetsenxSdk-api-future-release-v1.23.aar')
|
||
implementation files('libs/NewTVSDK-v4.0.3-app-lite.jar')
|
||
|
||
// 视频播放使用系统原生 MediaPlayer + SurfaceView,无需 ExoPlayer
|
||
|
||
// commons-codec(SDK 依赖)
|
||
implementation 'commons-codec:commons-codec:1.15'
|
||
|
||
// 火山引擎 TLS 日志库(JetsenxSdk 内部依赖)
|
||
implementation('io.github.volcengine-tls:tls-android-producer:2.0.2-api16') {
|
||
exclude group: 'com.google.guava', module: 'guava'
|
||
exclude group: 'com.google.guava', module: 'guava-jdk5'
|
||
exclude group: 'com.google.guava', module: 'guava-android'
|
||
exclude group: 'com.google.guava', module: 'listenablefuture'
|
||
}
|
||
implementation 'net.jpountz.lz4:lz4:1.3.0'
|
||
implementation 'org.slf4j:slf4j-android:1.7.36'
|
||
}
|
||
|
||
// 强制 OkHttp 3.12.0(3.12.1+ 包含 Android10Platform,引用 Android 10+ API,在 Android 4.x 上 VerifyError)
|
||
// 其他依赖传递引入 3.12.13,需 force 锁定 3.12.0
|
||
configurations.all {
|
||
resolutionStrategy.force 'com.squareup.okhttp3:okhttp:3.12.0'
|
||
}
|