Java – firebase cannot find the property serialized with the object in publishing mode

I wrote a method to push real-time location data to firebase:

private void writeNewMarker(int sessionType,String myUuid,String datetime,Location location) {
    locationToDB = new LocationFromAndroid();
    JSONObject jsonObjectCoords = new Coords(location.getLatitude() + "",location.getLongitude() + "",location.getAltitude() + "");
    locationToDB.setFinish("false");
    locationToDB.setLost("false");
    locationToDB.setCoords(jsonObjectCoords);
    locationToDB.setDistanceToGo("0");
    locationToDB.setheading(location.getBearing() + "");
    locationToDB.setNauwkeurigheid(location.getAccuracy() + "");
    locationToDB.setSpeed(location.getSpeed() * 3.6 + "");
    locationToDB.setSpeed2(location.getSpeed() + "");
    locationToDB.setTimestamp(location.getTime() + "");
    locationToDB.setWp_user(myUuid);
    locationToDB.setSessionType(sessionType);
    locationToDB.setTitle(title);
    if(myUuid != null && datetime != null && locationToDB.getTitle() != null && !myUuid.isEmpty() && !datetime.isEmpty()) {
        databaseRef.child(myUuid + "-Android" + sessionType + datetime).setValue(locationToDB);

When I build an application in debug mode, it works perfectly However, when I build it in the release mode of Google play, it will stop working on this line:

databaseRef.child(myUuid + "-Android" + sessionType + datetime).setValue(locationToDB);

More specifically, when I did this, everything was fine:

databaseRef.child(myUuid + "-Android" + sessionType + datetime).setValue("Test");

It looks like passing an object because the value cannot be obtained in the signed APK?

Error: exception com google. firebase. database. Databaseexception: no serialization property found on class

Solution

Add - keepclassmembers class com yourcompany. models.** {*; completed this trick in Proguard - rules. Pro

Proguard Rules Documentation

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>