Method count is moderately high in CBL for Android

I recently performed a method count of all of the dependencies I am using. Of course Google Play Services is the worst offender. Far in second place is Couchbase Lite. As it turns out CBL itself is reasonable at 2261 methods. But it appears that CBL has a dependency on FasterXML/Jackson which comes in at 9091 methods. The two together equal about 17% of your allowable 65k methods for an Android app.

A quick search reveals that Gson is now faster and only has about 1200 methods. Any chance of moving CBL to the smaller, faster library?


FYI to everyone reading this thread, this kind of discussion has been ongoing for a long while now ->

The current Java maintainer is out of town until the middle of this week, but after that I’ll see if we can rekindle this discussion.

I’m not a Java developer, but I have to ask: Is the number of methods in a library really a useful metric? What kind of real-world issues does it correlate with?

(Oops, I just saw “…your allowable 65k methods for an Android app”. WTF, there’s really a limited number of methods an app can have? What’s the point of that?)

I assume it is related to this ->

Android only has 16-bits of addressing for methods.

To be a little more specific, it’s the number of referenced methods. So if you define a method an don’t reference it, it’s not counted.

Yes, this is related and should help. But I would go a step further and either swap Jackson with Gson or allow/force the developer to provide a JSON parser. Or maybe there is a default? It just seems so great that CBL is only 2k methods and does one thing and then there’s this giant dependency on a specific JSON parser.

Hi @djensen47,
Thank you very much for your message.
Some other developers also have requested to support swappable JSON parser.
I created the ticket for this.