79 lines
2.6 KiB
Prolog
79 lines
2.6 KiB
Prolog
# ============ Flutter 核心 ============
|
|
-keep class io.flutter.** { *; }
|
|
-keep class io.flutter.plugins.** { *; }
|
|
-keep class io.flutter.plugin.** { *; }
|
|
-keep class io.flutter.util.** { *; }
|
|
-keep class io.flutter.view.** { *; }
|
|
-keep class io.flutter.embedding.** { *; }
|
|
|
|
# 保留 Flutter 的 JNI 调用类
|
|
-keep class io.flutter.embedding.engine.FlutterJNI { *; }
|
|
-dontwarn io.flutter.embedding.**
|
|
|
|
# ============ Kotlin ============
|
|
-keep class kotlin.** { *; }
|
|
-keep class kotlin.Metadata { *; }
|
|
-dontwarn kotlin.**
|
|
-keepclassmembers class **$WhenMappings {
|
|
<fields>;
|
|
}
|
|
-keepclassmembers class kotlin.Metadata {
|
|
public <methods>;
|
|
}
|
|
|
|
# ============ sqflite / SQLite ============
|
|
-keep class com.tekartik.sqflite.** { *; }
|
|
-dontwarn com.tekartik.sqflite.**
|
|
|
|
# ============ shared_preferences ============
|
|
-keep class io.flutter.plugins.sharedpreferences.** { *; }
|
|
|
|
# ============ path_provider ============
|
|
-keep class io.flutter.plugins.pathprovider.** { *; }
|
|
|
|
# ============ permission_handler ============
|
|
-keep class com.baseflow.permissionhandler.** { *; }
|
|
|
|
# ============ url_launcher ============
|
|
-keep class io.flutter.plugins.urllauncher.** { *; }
|
|
|
|
# ============ device_info_plus ============
|
|
-keep class dev.fluttercommunity.plus.device_info.** { *; }
|
|
|
|
# ============ 你的原生通道(重要!) ============
|
|
# 你的 MethodChannel / EventChannel 相关类需要保留
|
|
-keep class com.lxh.battery_health.** { *; }
|
|
|
|
# ============ AndroidX 常见 ============
|
|
-keep class androidx.lifecycle.** { *; }
|
|
-dontwarn androidx.lifecycle.**
|
|
|
|
# ============ 保留 Parcelable / Serializable ============
|
|
-keepclassmembers class * implements android.os.Parcelable {
|
|
public static final android.os.Parcelable$Creator *;
|
|
}
|
|
-keepclassmembers class * implements java.io.Serializable {
|
|
static final long serialVersionUID;
|
|
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
|
private void writeObject(java.io.ObjectOutputStream);
|
|
private void readObject(java.io.ObjectInputStream);
|
|
java.lang.Object writeReplace();
|
|
java.lang.Object readResolve();
|
|
}
|
|
|
|
# ============ 异常堆栈保留(方便排查 release 崩溃) ============
|
|
-keepattributes SourceFile,LineNumberTable
|
|
-renamesourcefileattribute SourceFile
|
|
-keepattributes Signature
|
|
-keepattributes *Annotation*
|
|
-keepattributes Exceptions
|
|
-keepattributes InnerClasses
|
|
-keepattributes EnclosingMethod
|
|
|
|
# ============ 移除日志(可选) ============
|
|
# 如果你想在 release 里保留日志,注释掉下面这几行
|
|
-assumenosideeffects class android.util.Log {
|
|
public static *** v(...);
|
|
public static *** d(...);
|
|
public static *** i(...);
|
|
} |