I'm trying to update a Firebase Object from Android. One of the field is a Date.
Something as simple as:
Map<String, Object> fields = new HashMap<String, Object>();
fields.put("endDate", new Date());
.... some more fields ....
firebaseRef.updateChildren(fields);
crashes with
Caused by: com.firebase.client.FirebaseException: Failed to parse node with class class java.util.Date
at com.firebase.client.snapshot.NodeUtilities.NodeFromJSON(NodeUtilities.java:84)
at com.firebase.client.snapshot.NodeUtilities.NodeFromJSON(NodeUtilities.java:12)
at com.firebase.client.utilities.Validation.parseAndValidateUpdate(Validation.java:127)
at com.firebase.client.Firebase.updateChildren(Firebase.java:438)
at com.firebase.client.Firebase.updateChildren(Firebase.java:426)
at com.mw.mydot.application.MyApp.updateRideOnPayment(MyApp.java:353)
at com.mw.mydot.FareSummaryActivity.onPaymentReceived(FareSummaryActivity.java:180)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.support.v7.internal.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:273)
at android.view.View.performClick(View.java:4456)
at android.view.View$PerformClick.run(View.java:18465)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
When I comment this line with Date field, all the other fields are updated normally.
NOTE: 'endDate' field is a new field that I'm trying to add to an existing object.