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 SDK #155

Open
ilians opened this issue Jun 8, 2021 · 5 comments
Open

Android SDK #155

ilians opened this issue Jun 8, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@ilians
Copy link

ilians commented Jun 8, 2021

The website currently states the Java SDK is currently not available due to the Java 8 dependency.
This now no longer seems to be true due to the Java 8 desugaring support

The current SDK seems to work correctly with Android though (using SDK 26+)

References:
https://developer.android.com/studio/write/java8-support
https://docs.commercetools.com/sdk/jvm-sdk#about-the-java-sdk

It might be helpful to add some integration docs though for Android defining the ProGuard / R8 rules required to run the project plus the minimum required Android version (and other helpful info?).

Having a dedicated Android SDK as some point in the future like Swift / iOS has would be even better as that could take care of stuff like storing the access token(s) on device for a persistent sessions or handing of anonymous sessions which now seems to be something that has to be configured manually.

@ilians ilians added the enhancement New feature or request label Jun 8, 2021
@jenschude
Copy link
Contributor

jenschude commented Jun 8, 2021

The docs description seems to be still mixing up some things between the v1 and v2 version. The Java SDK should be fine to be used with Android.

@jenschude
Copy link
Contributor

jenschude commented Jun 8, 2021

Also this hackathon demo is outdated now and may not be able to be compiled anymore it shows that the v2 could be used with Android https://github.com/katmatt/summerhack-2019

@ilians
Copy link
Author

ilians commented Jun 8, 2021

Whoops, I accidentally already posted the question when still writing.. sorry about that.
I've managed to get the Java SDK 2 working as well which is what caused me to post the enhancement here so that others may try and use it as well.

It might be helpful to add some integration docs though for Android defining the ProGuard / R8 rules required to run the project plus the minimum required Android version (and other helpful info?).

Having a dedicated Android SDK as some point in the future like Swift / iOS has would be even better as that could take care of stuff like storing the access token(s) on device for a persistent sessions or handing of anonymous sessions which now seems to be something that has to be configured manually.

@vaso92
Copy link

vaso92 commented Feb 27, 2024

Any update on proguard rules for android? Has anyone actually managed to use the sdk in android? I am getting errors:

Missing class javax.security.auth.login.AppConfigurationEntry$LoginModuleControlFlag (referenced from: javax.security.auth.login.AppConfigurationEntry[] org.asynchttpclient.spnego.SpnegoEngine$1.getAppConfigurationEntry(java.lang.String))
Missing class javax.security.auth.login.AppConfigurationEntry (referenced from: javax.security.auth.login.AppConfigurationEntry[] org.asynchttpclient.spnego.SpnegoEngine$1.getAppConfigurationEntry(java.lang.String))
Missing class org.osgi.framework.Bundle (referenced from: java.lang.Object org.javamoney.moneta.OSGIServiceHelper$JDKUtilServiceFactory.getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration) and 7 other contexts)
Missing class org.osgi.framework.BundleActivator (referenced from: org.javamoney.moneta.internal.OSGIActivator)
Missing class org.osgi.framework.BundleContext (referenced from: org.osgi.framework.BundleContext org.javamoney.moneta.internal.OSGIServiceProvider.bundleContext and 10 other contexts)
Missing class org.osgi.framework.InvalidSyntaxException (referenced from: java.util.List org.javamoney.moneta.internal.OSGIServiceProvider.getServices(java.lang.Class))
Missing class org.osgi.framework.ServiceFactory (referenced from: org.javamoney.moneta.OSGIServiceHelper$JDKUtilServiceFactory)
Missing class org.osgi.framework.ServiceReference (referenced from: void org.javamoney.moneta.OSGIServiceHelper.unregisterService(org.osgi.framework.Bundle, java.lang.Class, java.lang.Class) and 5 other contexts)
Missing class org.osgi.framework.ServiceRegistration (referenced from: java.lang.Object org.javamoney.moneta.OSGIServiceHelper$JDKUtilServiceFactory.getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration) and 2 other contexts)
Missing class org.osgi.framework.Version (referenced from: void org.javamoney.moneta.OSGIServiceHelper.registerService(org.osgi.framework.Bundle, java.lang.Class, java.lang.Class))

@jenschude
Copy link
Contributor

jenschude commented Feb 29, 2024

No we didn't tested it yet and it's not planned at the moment.

The errors reported coming from the AsyncHttpClient. You may want to use commercetools-okhttpl-client4 instead as OkHttp already publishes proguard rules.

The other errors are coming from java money and moneta. You may have to try to keep the OSGI, javax and org.javamoney classes.

Another option would be for testing purposes to disable the minify process as it had been done in the hackathon app: https://github.com/katmatt/summerhack-2019/blob/master/app/build.gradle#L23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants