fix: Android 4.2 兼容性修复 - 降级第三方库 + 移除 ExoPlayer + multidex 配置
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 兼容性改动文档
This commit is contained in:
@@ -1,6 +1,28 @@
|
||||
# Android 4.x Dalvik multidex 兼容配置
|
||||
# InitializationProvider 已从 manifest 移除,仅需保留 App 自身启动类
|
||||
#
|
||||
# 核心原则:Dalvik multidex 下,只有以下两种场景无法加载 secondary dex 中的类
|
||||
# 1. Android 框架级反射:LayoutInflater.createView 使用框架 ClassLoader
|
||||
# 创建 View 时找不到 secondary dex 中的 AppCompat 控件类
|
||||
# 2. 协程内部类加载:kotlinx.coroutines 内部加载 CoroutineExceptionHandlerImplKt
|
||||
# 等核心类时,在 Dalvik multidex 下失败
|
||||
# 注意:已将主题从 MaterialComponents 改为 AppCompat,避免 MaterialComponentsViewInflater
|
||||
# 的 multidex 类加载问题,同时减少主 dex 方法数(material 包约 20000+ 方法)
|
||||
|
||||
# App 自身核心类
|
||||
-keep class com.pukka.mediaapp.PartnerApp { *; }
|
||||
-keep class com.pukka.mediaapp.ui.PartnerLaunchActivity { *; }
|
||||
# === 项目自身所有类 ===
|
||||
-keep class com.pukka.mediaapp.** { *; }
|
||||
|
||||
# === AppCompat 完整包(app + widget)===
|
||||
# LayoutInflater.createViewFromTag 反射创建:FitWindowsLinearLayout、AppCompatButton 等
|
||||
# AppCompatDelegateImpl.createSubDecor inflate 内部装饰布局
|
||||
-keep class androidx.appcompat.app.** { *; }
|
||||
-keep class androidx.appcompat.widget.** { *; }
|
||||
|
||||
# === Kotlin Coroutines ===
|
||||
# 协程启动时内部加载 CoroutineExceptionHandlerImplKt(无法从 secondary dex 加载)
|
||||
# 覆盖 flow(StateFlow)、android(Dispatchers)、internal 等
|
||||
-keep class kotlinx.coroutines.** { *; }
|
||||
|
||||
# === Retrofit ===
|
||||
# KotlinExtensions.await() 被 HttpServiceMethod 在运行时调用,suspend 函数支持
|
||||
-keep class retrofit2.** { *; }
|
||||
|
||||
Reference in New Issue
Block a user