Adyen / adyen-java-api-library

Adyen API Library for Java
MIT License
108 stars 130 forks source link

Android support below Android 8 #1281

Open jnischler opened 2 weeks ago

jnischler commented 2 weeks ago

Hey,

we are using your library in one of our payment applications. As we need local communication with your terminals, we need to use this library or at least the models locally.

In the past you made several changes preventing us from using newer versions of your library, as the used functions are not available on android.

So far, we identified at least two problems. The Jackson version is too high. See issue: https://github.com/FasterXML/jackson-databind/issues/3658 2.14+ is no longer supported by Android Versions below 8. We tried the library with an older Jackson version, and everything works just fine. See: https://github.com/FasterXML/jackson-databind?tab=readme-ov-file#compatibility

As we have a lot of payment devices with android 7 we need to use at max Jackson 2.13.X.

Using gradle “resolutionStrategy.force” we can force the Jackson version to an older version.

We also identified another problem caused by the base64 functions used.

A wile ago you replaced the apache base64 library with java.utils.Base64. https://github.com/Adyen/adyen-java-api-library/commit/891748f221506e296b3fbcd426a4afb517d887b2 java.utils.Base64 is only available from API Level 26+ (Android 8)

I fully understand that using older Version of a library might not be that modern but it also breaks support for older devices. Especially payment devices trend to not feature the latest android versions and therefore a lot of devices are still using Android 7 or even Android 5.

Just have a look at your own devices https://docs.adyen.com/point-of-sale/android-terminals/.

What is the recommended way to go?

Thanks and best regards Julian

jillingk commented 2 weeks ago

Hi @jnischler,

Thanks for reaching out to us with this issue. We were not aware of these version issues with Android, but I fully agree with you that it would make sense to be compatible with our own devices and their respective android versions. I created an internal ticket to review our dependencies and see whether we are able to downgrade some of them. We will keep you posted!

Best, Jilling Adyen

jnischler commented 2 weeks ago

Hi @jillingk.

Thanks for the update, In the prerequisites you also mention Java 11. https://github.com/Adyen/adyen-java-api-library?tab=readme-ov-file#prerequisites

Android does support Java 11 features through desugaring but only a subset: https://developer.android.com/studio/write/java11-default-support-table

As of now we only noticed the 2 already mentioned problems.

As an alternative to Jackson you could have a look at google gson: https://github.com/google/gson

Or if you would like to boost performance then you could consider dsl-json: https://github.com/ngs-doo/dsl-json

Another idea would be to consider creating a plain Kotlin library. With Kotlin "kotlinx.serialization".

If we can help in any way, feel free to reach out.

Regards Julian

jillingk commented 1 week ago

Hi @jnischler,

Actually even though we mention java 11 on the readme, technically the library is still compatible with java 8 so that you don't have that to worry about!

As for the serialization library, we actually specifically migrated away from GSON to Jackson as this was in our opinion the industry standard (by a small margin). What I would like to do however is see if I can downgrade our jackson dependencies so we're compatible with older android versions. We will try to pick this up asap.

Kotlin library we've been thinking about for a while now. I will poke around and see if this is something we can build, however don't hold any hope as we might have other priorities for now :)

I'll come back to you once I've managed to downgrade above mentioned dependencies!

Best, Jilling Adyen

jnischler commented 1 week ago

Hi Jilling,

Of course I understand just wanted to give you some hints :)

We did test the library with an older Version of Jackson and everything worked for us. But we didn't to a lot of testing. We are using: 2.13.5

Regards Julian