Start a new topic

NullPointerException in OfflineTable.insertEntity

I am getting this crash:






at android.os.AsyncTask.finish(

at android.os.AsyncTask.access$600(

at android.os.AsyncTask$InternalHandler.handleMessage(

at android.os.Handler.dispatchMessage(

at android.os.Looper.loop(


at java.lang.reflect.Method.invokeNative(Native Method)

at java.lang.reflect.Method.invoke(



at dalvik.system.NativeStart.main(Native Method)

when saving my object to the offline table. The crash happens in the background sync service process. This is using version 2.6.15 of the android lib jar.

We do have business logic executing on save, so this may be causing the returned JSON to be invalid. Is there any way I can see what is returned, or why this crash would occur?

1 Comment


That line in the OfflineTable class is confirming the existence of an `_id` within the object, before it is written to the local storage. It seems there is no _id field, so it crashing with a null pointer.

Try first enabling debug mode so you can see the raw HTTP requests and responses by following these instructions:

Then, try setting the offline policy to "ALWAYS_ONLINE" and executing the same request-- you should see the original request going over the network, and eventually the response coming back. Double check that there is an `_id` field present in the response, and if it isn't then double check the business logic and ensure this field is forwarded on. Note that every entity coming back from a save request (PUT or POST) should contain an _id, provided by the Kinvey service if one doesn't exist.

Login or Signup to post a comment