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

Android support below Android 8 #1281

Closed
jnischler opened this issue Apr 26, 2024 · 16 comments
Closed

Android support below Android 8 #1281

jnischler opened this issue Apr 26, 2024 · 16 comments
Labels
Bug report Indicates that issue has been marked as a possible bug by its creator

Comments

@jnischler
Copy link

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: FasterXML/jackson-databind#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.
891748f
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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

jillingk commented May 3, 2024

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
Copy link
Author

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

@runemart
Copy link

runemart commented May 24, 2024

Struggeling with the same issue.

Managed to bypass the Jackson issue by excluding Jackson dependency from adyen-java-api lib, and including a version lower than 2.14 in app build file.

However, the missing java.util.Base64 is still unsolved.

Hoping for a fix soon.

Edit: using Adyen S1E devices, running Android 7.

@jnischler
Copy link
Author

Struggeling with the same issue.

Managed to bypass the Jackson issue by excluding Jackson dependency from adyen-java-api lib, and including a version lower than 2.14 in app build file.

However, the missing java.util.Base64 is still unsolved.

Hoping for a fix soon.

Edit: using Adyen S1E devices, running Android 7.

to force gradle to always use a specific version of jackson we use this snipet:

resolutionStrategy.force(
		// jackson version 2.14+ Android SDK 26+ as we need to target lower SDK versions
		// we need to prevent libs to increase the jackson version
		// for example adyen did increase the jackson version and this caused a failure on some devices
		// see https://github.com/FasterXML/jackson-databind?tab=readme-ov-file#jdk
		"com.fasterxml.jackson.core:jackson-core:$jacksonVersion",
		"com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion",
		"com.fasterxml.jackson.core:jackson-databind:$jacksonVersion",
		"com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion",
		"com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion"
	)

@DjoykeAbyah DjoykeAbyah changed the title Android support below Android 8 ECP-9233: Android support below Android 8 Jun 6, 2024
@DjoykeAbyah DjoykeAbyah added the Bug report Indicates that issue has been marked as a possible bug by its creator label Jun 6, 2024
@DjoykeAbyah DjoykeAbyah changed the title ECP-9233: Android support below Android 8 Android support below Android 8 Jun 7, 2024
@jnischler
Copy link
Author

Hey @DjoykeAbyah , @jillingk.

Sorry for bother you again.
But we would really need to know if you are working on a fix for this issue or if we need to find a workaround on our side.

Thanks, you very much.
Beste regards
Julian

@maxmauthner
Copy link

Hi @DjoykeAbyah @jillingk,
do you have any update on this topic?
Thanks and best,
Max

@DjoykeAbyah
Copy link
Member

Hi @maxmauthner,

Thank you for your patience, and I apologize for the delay in getting back to you. We're currently investigating the issue to ensure we make the most sustainable choice. I'll keep you updated with any progress.

Kind regards,

Djoyke
Adyen

@DjoykeAbyah
Copy link
Member

DjoykeAbyah commented Aug 23, 2024

Hi @maxmauthner, @jnischler, and @runemart,

We've downgraded the Jackson dependencies to ensure compatibility with Android 7. Regarding the java.util.Base64 import, we're currently exploring a sustainable solution to add support for Android 7.

We'll keep you updated!

Best regards,

Djoyke
Adyen

@DjoykeAbyah
Copy link
Member

Hi @maxmauthner, @jnischler and @runemart,

I wanted to let you know we've just downgraded the dependency for Base64. link to pr!

Kind regards,

Djoyke
Adyen

@grossrichard
Copy link

Hi, @DjoykeAbyah this issue hasn't been fixed in v28.3.0 on Android.
I get this build error.

Failed to transform jackson-core-2.17.2.jar (com.fasterxml.jackson.core:jackson-core:2.17.2) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.

I tried to force jackson's version which I am using in the project (2.13.1), but unsuccessfully.
It looks that version of jackson has been downgraded to Android's compatible Java version, but there is revert of this downgrade, too. I don't know if this change was intentional or a mistake, but anyway, please help me, because I need to build up your library.

@jillingk
Copy link
Contributor

jillingk commented Sep 4, 2024

Hi @grossrichard,

Sorry I see indeed we forgot to update both our Jackson dependencies. I've just now updated them both correctly and triggered our release so you should be able to check this works in release v28.3.1.

Please keep us posted as to whether this works for you!

Best, Jilling
Adyen

@jnischler
Copy link
Author

sorry for the delay.
Yes your changes worked thanks.
We are now using the latest version.

Thanks

@runemart
Copy link

runemart commented Oct 17, 2024

Hi @DjoykeAbyah, I got to test version 28.5.1 today, and it appears java.util.Base64 is used in ByteArrayToBase64TypeAdapter.java also, which causes crash (NoClassDefFoundError) on Android 7.
I found other references to import java.util.Base64 also, but not sure how they impact apps.

at com.adyen.terminal.serialization.ByteArrayToBase64TypeAdapter.serialize(ByteArrayToBase64TypeAdapter.java:40)
at com.adyen.terminal.serialization.ByteArrayToBase64TypeAdapter.serialize(ByteArrayToBase64TypeAdapter.java:34)
at com.google.gson.internal.bind.TreeTypeAdapter.write(TreeTypeAdapter.java:108)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:73)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$2.write(ReflectiveTypeAdapterFactory.java:247)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:490)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:73)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$2.write(ReflectiveTypeAdapterFactory.java:247)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:490)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:73)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$2.write(ReflectiveTypeAdapterFactory.java:247)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:490)
at com.google.gson.Gson.toJson(Gson.java:944)
at com.google.gson.Gson.toJson(Gson.java:899)
at com.google.gson.Gson.toJson(Gson.java:848)
at com.google.gson.Gson.toJson(Gson.java:825)
at com.adyen.service.TerminalLocalAPI.request(TerminalLocalAPI.java:65)
at no.wtw.paymentterminal.adyen.DoDiagnostics.doDiagnostics(DoDiagnostics.java:41)
at no.wtw.paymentterminal.AdyenPaymentTerminal.init(AdyenPaymentTerminal.java:129)
at com.linefare.inspector.android.data.repository.PaymentTerminalRepositoryImpl$initialize$4.invokeSuspend(PaymentTerminalRepositoryImpl.kt:94)
...

@jillingk
Copy link
Contributor

jillingk commented Oct 17, 2024

Hi @runemart,

Thanks for bringing this to our attention, I see we missed a couple references to java.util. I'm removing them in #1376.

Best, Jilling
Adyen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Indicates that issue has been marked as a possible bug by its creator
Projects
None yet
Development

No branches or pull requests

6 participants