ClassCastException when removing an object

I’m getting this error when I try to remove an object

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
at com.backendless.FootprintsManager$Inner.removeFootprintForObject(FootprintsManager.java:319)
at com.backendless.Persistence$5.handleResponse(Persistence.java:306)
at com.backendless.async.message.AsyncMessage$ResponseHandler.handle(AsyncMessage.java:64)
at com.backendless.async.message.AsyncMessage.handleCallback(AsyncMessage.java:41)
at com.backendless.core.AndroidCarrier$1.handleMessage(AndroidCarrier.java:37)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

And this is my code where this is happening


private void deleteObject(MyClass object) {
		Backendless.Persistence.of(MyClass.class).remove(object, new AsyncCallback<Long>() {
			@Override
			public void handleResponse(Long response) {
				//Call another method
			}
			
			@Override
			public void handleFault(BackendlessFault fault) {
			}
		});
	}

Hi,

Please check whether the object you are passing in a delete request is an actual Backendless object. I’ve just tried sync/async APIs according to documentation and it works correctly.

Anton

I have a custom class structured as described in the documentation. The object is of that class. It used to work before adding a relation column, but ever since I added that it stopped working

Hello,
could you please try to remove the object via REST API and check whether it works correctly?

Also please provide your APP_ID.

Regards, Olga

I’ll try to remove the object via REST API and let you know what happens. Thing is, the object gets removed even with the Android API, just the app crashes at that point.

My APP ID: 6FC1BED5-C889-2471-FF68-119E9F47F500

Everything works fine with the REST API. You can mark this questions as answered. Thanks!