Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
668 views
in Technique[技术] by (71.8m points)

java - Firebase No properties to serialize found with object in release mode

I've written a method for pushing 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'm building the app in debug mode, it works perfectly fine. But when I'm building it in Release mode for Google Play, it stops working at this line:

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

To be more specific: When I'm doing this, everything is OK:

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

It does look like passing an object as value isn't possible within a signed APK?

Error: Exception com.google.firebase.database.DatabaseException: No properties to serialize found on class

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...