Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON library incompatible with Android #1

Open
marcnause opened this issue Jun 4, 2016 · 4 comments
Open

JSON library incompatible with Android #1

marcnause opened this issue Jun 4, 2016 · 4 comments

Comments

@marcnause
Copy link
Member

loklakj_lib uses the json.org JSON library. Android also uses json.org: https://developer.android.com/reference/org/json/package-summary.html

Unfortunately both versions are not compatible. The version used in loklakj_lib knows JSONObject.put(String, Collection) which is used in org.loklak.objects.MessageEntry for example. The version contained in Android does not know this method.

This seems to be the reason for the Android-Wok not being able to push data at the moment:

failed synchronous push to backend, attempt 4 java.lang.NoSuchMethodError: org.json.JSONObject.put at org.loklak.objects.MessageEntry.toJSON(Unknown Source) at org.loklak.objects.Timeline.toJSON(Unknown Source) at org.loklak.client.PushClient.push(Unknown Source) at org.loklak.android.wok.Harvester$PushThread.doInBackground(Harvester.java:263) at org.loklak.android.wok.Harvester$PushThread.doInBackground(Harvester.java:244) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841)

Unfortunately I think the only solution is to replace json.org.

@marcnause
Copy link
Member Author

Thinking about it again, I think it should be possible to keep json.org in the project and write a workaround for Android. I'll try to come up with a solution ASAP and will create a pull request when I'm done.

@marcnause
Copy link
Member Author

Pull request: #2

marcnause added a commit to marcnause/loklak_wok_android that referenced this issue Jun 6, 2016
@sudheesh001
Copy link
Member

@Low012 Merged it , Is the server issue fixed too with this change ? loklak/loklak_server#544

@marcnause
Copy link
Member Author

The "HTTP code 504"-issue is a separate issue which I encountered both on an Android device running Loklak Wok for Android and on my Laptop running Loklak Wok for desktop.

This issue prevented POSTing messages to the backend since it already crashed when the JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants