What version of org.json is built into Android?
Asked Answered
W

1

17

I'm using an open source library that depends on org.json:json:20090211. Evidently there are some API differences between version 20090211 and whatever version is provided by Android. When I enable ProGuard minimization, I see this warning:

Warning: com.esri.core.geometry.JSONObjectEnumerator: can't find referenced method 'java.lang.String[] getNames(org.json.JSONObject)' in library class org.json.JSONObject

That method is present in the current reference implementation of JSONObject, so I assume it was added sometime before version 20090211, as opposed to removed after it, which means the version included in Android is older. I'd like to diff that version against 20090211 and see what needs to be done to make the library that depends on 20090211 compatible with Android.

What version of org.json is included in Android?

(I know I could rename org.json and change the dependency to the renamed version, but I'd like to avoid that if possible. Such a change is unlikely to be accepted upstream.)

Windpipe answered 19/9, 2016 at 3:29 Comment(0)
W
20

I'm uncertain of this answer, but the Android version may correspond to no official version. This comment appears in the AOSP source for JSONObject:

// Note: this class was written without inspecting the non-free org.json sourcecode.

The org.json license is identical to the MIT license, with one addition:

The Software shall be used for Good, not Evil.

So perhaps Google considered that clause too restrictive, and felt the need to reimplement org.json from scratch.

Windpipe answered 19/9, 2016 at 3:42 Comment(1)
This is really annoying, because the two are incompatible. Third party libraries using official version of org.json will be broken when used in the Android app. For this reason, I forked the offical version of org.json with another package name in my own projects. Which should be done by Google IMHO.Lillylillywhite

© 2022 - 2024 — McMap. All rights reserved.