build: 添加 ProGuard 规则以保留必要类和方法

- 保留 ArmCloudApiClient 及其公共方法和构造函数
-保留 PropertyItem 内部类及其字段、构造函数和 toJson 方法- 保留枚举类及其 values 和 valueOf 方法
- 保留使用 @SerializedName 注解的字段- 可选地保留注解信息
This commit is contained in:
yjj38 2025-07-10 14:30:13 +08:00
parent 64449de581
commit faa865cb34
2 changed files with 27 additions and 0 deletions

27
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,27 @@
# 保留 ArmCloudApiClient 及其所有公共方法和构造函数
-keep class com.example.retention.device.ArmCloudApiClient {
public <init>();
public *;
}
# 保留 PropertyItem 内部类及其字段构造函数和 toJson 方法
-keep class com.example.retention.device.ArmCloudApiClient$PropertyItem {
private java.lang.String propertiesName;
private java.lang.String propertiesValue;
public <init>(java.lang.String, java.lang.String);
public org.json.JSONObject toJson();
}
# 保留枚举类
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# 保留使用 @SerializedName 注解的字段
-keepclassmembers class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# 保留注解信息(根据需要启用)
# -keepattributes *Annotation*