Start a new topic

Offline storage parse error

Hello,



I'm using the offline datastore but the sqlite storage is never used :



> trackDao.setCache(new InMemoryLRUCache(), CachePolicy.CACHEFIRST); // add memory caching



> trackDao.setOffline(OfflinePolicy.LOCAL_FIRST, new SqlLiteOfflineStore

(getActivity().getApplicationContext())); // add offline disk storage



> trackDao.get(query, new KinveyListCallback() {



> @Override



> public void onSuccess(Track[] tracks) {



> if(tracks == null) {



> onLoadingError();



> } else {



> // use of tracks here



> }



> }



If no connection is available, tracks == null (not using the offline sqlite datastore).



There is an IO exception shown in the stacktrace : http://demo.ovh.eu/download/628935c646a1667017f553ab1bdbf7f8/stacktrace.txt



@Damien , do I made a mistake ?



Thank you.

Good morning @fabreax ,



So, upon reviewing your stack trace we found the following:



02-01 13:44:53.340 7634-7669/com.fabreax.android.kartingtools.activity:backgroundsync W/System.err? Unable to parse the JSON in the request



If you have any idea why this might be happening it might be a quick fix for you. Otherwise if you can turn on debug logging (http://devcenter.kinvey.com/android/guides/troubleshooting ) and get back to us with a log, that would be very helpful in us troubleshooting this.



It is worth mentioning that all JSON must be UTF-8 encoded, as non UTF-8 charsets can throw errors.



Please let me know if you have any other questions or concerns,



Thanks,
Thank you Damien, it seems to be related to the user (bad request) but I don't understand why.



This is the complete log file : http://demo.ovh.eu/fr/7db84008833f49d53b2e5403d0b13f5e/
Fabreax: I can't get to that url. It doesn't load properly for me.
Please retry
Fabreax: Upon digging through that stacktrace I found the following request:



https://baas.kinvey.com/appdata/kid_-1tyLEkUr/Track/?query={"country":"United States"}&sort={"trackName" : 1}



Can you tell me how you're creating that query?



Thanks,
Thank you Damien.



I don't see the difference because of the forum formatter.



This is how I create the query :

final Client kinveyClient = new Client.Builder(getActivity().getApplicationContext()).build();

AsyncAppData trackDao = kinveyClient.appData("Track", Track.class);

Query query = new Query();

query.equals("country", country);

query.addSort("trackName", AbstractQuery.SortOrder.ASC);

trackDao.setCache(new InMemoryLRUCache(), CachePolicy.CACHEFIRST);

trackDao.setOffline(OfflinePolicy.LOCAL_FIRST, new SqlLiteOfflineStore(getActivity().getApplicationContext()));

trackDao.get(query, new KinveyListCallback() {...});
Fabreax:



Can you try to disable the offline stuff and see if you are still getting errors? We are thinking that there may be an issue with the library encoding offline requests.



Thanks,
This is the log without the following lines :



trackDao.setCache(new InMemoryLRUCache(), CachePolicy.CACHEFIRST);

trackDao.setOffline(OfflinePolicy.LOCAL_FIRST, new SqlLiteOfflineStore(getActivity().getApplicationContext()));





http://demo.ovh.eu/fr/cb613e692d9b53a6806fbed73c6ccc58/



I'm sure that there is no error without the offline sync management.
fabreax:



It appears the issue you're running into is due to a problem with urlencoding in our offline library. I will get back to you (hopefully later today) with a timeline about how long it will take to fix this.



Thanks,
Thank you Damien, please let me know when the bug will be fixed.
Fabreax: We believe that this issue will be resolved by the end of next week. The engineer who will be fixing it is confident that it won't be a difficult fix, but it will involve releasing an update to the library, so you will need to download that when it becomes available.



I will update this post when we get this issue resolved. Thank you for reporting this issue.
I understand, thank you.
Hello Damien, could you tell me when a new version of the Android SDK will be released ?
Fabreax: This was fixed last night, but I don't believe that we've finished internally testing the SDK yet. I would expect a release before the end of this week.



Thanks,
Login or Signup to post a comment