2026-07-28 11:36:03 +08:00
|
|
|
|
# Android 4.x Dalvik multidex 兼容配置
|
|
|
|
|
|
# InitializationProvider 已从 manifest 移除,仅需保留 App 自身启动类
|
2026-07-28 19:47:57 +08:00
|
|
|
|
#
|
|
|
|
|
|
# 核心原则: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+ 方法)
|
2026-07-28 11:36:03 +08:00
|
|
|
|
|
2026-07-28 19:47:57 +08:00
|
|
|
|
# === 项目自身所有类 ===
|
|
|
|
|
|
-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.** { *; }
|