你好,firebase 开始自动更改我的字段名称,这造成了一个大问题
如何解决这个问题:
我的班级
public class TUser {
private String UserKey;
private String LicenceKey;
private String UserName;
private Boolean Active;
private String LoginDateTime;
private String InstanceId;
private String AcenteAdi;
private String Version;
private String MethodName;
public TUser() {
}
public TUser(String userKey, String licenceKey, String userName, Boolean active, String loginDateTime, String instanceId, String acenteAdi, String version, String methodName) {
UserKey = userKey;
LicenceKey = licenceKey;
UserName = userName;
Active = active;
LoginDateTime = loginDateTime;
InstanceId = instanceId;
AcenteAdi = acenteAdi;
Version = version;
MethodName = methodName;
}
// ************ get set etc ****
}
我已将 build.gradle(module) 中的
minifyEnabled
从 true
更改为 false
minifyEnabled: false
这对我有用......!
您可以保留启用此设置
isMinifyEnabled = true
和isShrinkResources = true
以防止逆向工程等
相反,要将数据库文件夹排除在“收缩”之外,您可以在“proguard-rules.pro”文件中添加下一行:
-保留类 com.applicationName.db.models.class.** { *; }
示例:
文件:build.gradle.kts(模块:app)
buildTypes {
release {
// Enables code shrinking, obfuscation, and optimization for only
// your project's release build type. Make sure to use a build
// variant with `isDebuggable=false`.
isMinifyEnabled = true
isDebuggable = false
// Enables resource shrinking, which is performed by the
// Android Gradle plugin.
isShrinkResources = true
proguardFiles(
// Includes the default ProGuard rules files that are packaged with
// the Android Gradle plugin. To learn more, go to the section about
// R8 configuration files.
getDefaultProguardFile("proguard-android-optimize.txt"),
// Includes a local, custom Proguard rules file
"proguard-rules.pro"
)
}
}
文件:proguard-rules.pro
-keep class com.applicationName.db.models.** { *; }