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

Version 2.9.7 breaks compatibility with Android minSdk < 24 #176

Closed
jurriaan opened this issue Sep 24, 2018 · 9 comments
Closed

Version 2.9.7 breaks compatibility with Android minSdk < 24 #176

jurriaan opened this issue Sep 24, 2018 · 9 comments
Milestone

Comments

@jurriaan
Copy link

By using the method getAnnotationsByType in commit 0d4ab3b this library breaks compatibility with Android versions with minSdk < 24

See https://developer.android.com/studio/write/java8-support#supported_features for more information.

I've reverted to v2.9.6 in the meantime.

@JeremiahStephenson
Copy link

This issue just caused me a lot of pain. It was only after figuring out the problem myself that I discovered this bug report.

@frnusmartobjects
Copy link

frnusmartobjects commented Nov 26, 2018

I have the same issue but I can't revert to 2.9.6 since I need the fix from the issue #168.
What alternatives do I have or is there an ETA for an upcoming fix?

EDIT:

The method usages can be replaced safely apparently with

annotations.firstOrNull { it.annotationClass == JsonProperty::class }?.let { it as JsonProperty }?.required

I don't have experience with open source projects that's why I post here the answer.

sashjakk added a commit to sashjakk/jackson-module-kotlin that referenced this issue Dec 4, 2018
@alashow
Copy link

alashow commented Mar 4, 2019

Is the fix going to be included in 3.0.0?

/cc @apatrida @cowtowncoder

@chrisjenx
Copy link

Looks like the solution to this is if you want 1.3 Kotlin + Android 21+ then you need to use Moshi or GSON.

@JeremiahStephenson
Copy link

Yeah, I gave up waiting for a solution so I switched over to Moshi.

@alashow
Copy link

alashow commented May 15, 2019

Well, that would suck - refactoring jackson out just because that small fix is not implemented.

@chrisjenx
Copy link

@alashow sure, but seen as Moshi can also generate adapters for you and not require the use of the reflect library, it is a better choice in most cases for Android dev.

@JeremiahStephenson
Copy link

Moshi is more lightweight than Jackson and helped reduce the overall size of the app I work on. This was significant as we were trying to create a version that's below the 4MB limit for an instant app.

@cowtowncoder
Copy link
Member

Aside from Moshi which is a fine library too, I would recommend checking out jackson-jr (jackson-jr-objects in particular):

https://github.com/FasterXML/jackson-jr

Jackson-jr uses Jackson's streaming (jackson-core), but object binding focuses on minimalism (supports List/Map but also Beans), quick startup time, small jar (within constraints of jackson-core).
There is also optional minimal tree model, as well as retrofit module.

I haven't gotten as much feedback on jackson-jr as I hoped for, considering it was specifically designed to address startup time challenges wrt Android, so any feedback would be helpful (including bug reports for problems to overcome).

StephaneBg pushed a commit to StephaneBg/jackson-module-kotlin that referenced this issue Oct 10, 2019
cowtowncoder pushed a commit that referenced this issue Oct 14, 2019
… < 24 (#255)

Fix issue #176 - Remove Java 8 method not compatible with Android API < 24
cowtowncoder pushed a commit that referenced this issue Oct 14, 2019
@cowtowncoder cowtowncoder added this to the 2.10.1 milestone Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants