-
Notifications
You must be signed in to change notification settings - Fork 21
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
Support for JsonDocument on Android #65
Comments
Wow, Android is using the 2007 version of org.json. That's very annoying. I almost wonder if we should/could package many of these dependencies right into the jar for mechanize (at least for an android version.) Possibly the maven shade plugin... |
I've used the maven shade plugin to try to resolve this issue (by embedding the latest org.json code into the mechanize jar as org.shaded.json). Here's a download link for this variation of the mechanize library: I still need to figure out how to effectively publish this... I'd like this variation of the library to be in the maven repos as a mechanize jar in the context of android. At least I think that's what I want... |
Not context, but classifier. Here is a link that might contain the details for how to publish different ways based on profiles: |
The latest code seemed to work, I've published the main artifact and also an "android" classifier that includes the shaded org.shaded.json package. Here's the maven dependency:
|
mechanize for Java works correctly with HtmlDocument for HTML pages, but warnings below will be shown in logcat when instantiating MechanizeAgent.
Because of this class loading error, JsonDocument is not available on Android. Following exception will be thrown when loading JSON pages (like https://www.googleapis.com/urlshortener/v1/url).
This error may be caused by limitation of Android. Android does not support org.json library fully (or uses too old version), so lacks JSONTokener(java.io.Reader) constructor.
http://developer.android.com/reference/org/json/JSONTokener.html#pubctors
I'm currently using mechanize with patch to import another org.json library in another namespace (built and placed by hand), but I hope this problem be solved in master branch.
The text was updated successfully, but these errors were encountered: