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

java.lang.ClassNotFoundException: Didn't find class "java.util.Base64" #690

Closed
erictamhk opened this issue May 18, 2023 · 4 comments
Closed
Assignees
Labels
Component: smtp wontfix This will not be worked on

Comments

@erictamhk
Copy link

erictamhk commented May 18, 2023

Describe the bug
when using android 7, API 23, got this error

dependencies
implementation 'org.eclipse.angus:jakarta.mail:2.0.1'
implementation 'org.eclipse.angus:angus-activation:2.0.1'
implementation 'jakarta.activation:jakarta.activation-api:2.1.2'

Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/util/Base64;
at org.eclipse.angus.mail.smtp.SMTPTransport$LoginAuthenticator.doAuth(SMTPTransport.java:1010)
at org.eclipse.angus.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:955)
at org.eclipse.angus.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:889)
at org.eclipse.angus.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:793)

@jmehrens
Copy link
Contributor

jmehrens commented Jun 26, 2023

The version of Android meets requirements per https://eclipse-ee4j.github.io/angus-mail/Android

Angus Mail for Android requires at least Android API level 19, which corresponds to Android KitKat, currently the oldest supported version of Android.

Per the Base64 API this class was added in JDK 8.

However, per https://developer.android.com/reference/java/util/Base64:

Added in API level 26
Base64

For JakartaMail, I think we'll need to review what the minimum version of Android should be supported. If we require API 26 then this ticket will just be closed. Looking at #554 it seems that this ticket should be closed and a new linked ticket should be created to update the documentation.

For AngusMail, I think we could look at switching to use MimeUtility.encode with ByteArrayOutputStream or BASE64EncoderStream.encode(user.getBytes(StandardCharsets.UTF_8)) to replace the use of Base64. If I recall correctly there are some differences in how some characters are handled.

@jmehrens
Copy link
Contributor

Per Meet Google Play's target API level requirement:

Starting on August 31, 2023:

New apps must target Android 13 (API level 33) or higher; except for Wear OS apps, which must target a version between Android 11 (API level 30) and Android 13 (API level 33), inclusive.

App updates must target Android 13 or higher and adjust for behavioral changes in Android 13; except for Wear OS apps, which must target Android 11.

Permanently private apps—which are restricted to users in a specific organization and are intended for internal distribution only—aren't required to meet the target API level requirements.

[snip]

...Furthermore, as of Android 10 (API level 29), users see a warning when they start an app for the first time if the app targets Android 5.1 (API level 22) or lower.

Per Which Java APIs can I use in my Java or Kotlin source code? the API level 32 and API level 33 are versions that support Java 11 source syntax. API level 34 supports Java 17 source syntax.

Per Jakarta EE Platform 10:

Minimum Java SE Version
Java SE 11 or higher

The Android API Levels site shows the usage of devices.

Given that information we should close this ticket as will not fix and create new ticket to move the minimum API version for JakartaMail and Angus Mail to API 33 as that would allow us to stop building for JDK 8. Moving to that API version 26 or greater will give access to java.lang.invoke, java.util.Base64, and java.time. If we want to still target JDK 8 then we should require API version 26.

@lukasj What are your thoughts?

@jmehrens jmehrens added the wontfix This will not be worked on label Jan 22, 2024
@lukasj
Copy link
Contributor

lukasj commented Jan 22, 2024

@jmehrens I'm for jumping to API 33+/SE 11 as a base

@jmehrens
Copy link
Contributor

Closed as won't fix because Android 7, API 23 is no longer supported.
This issue has been superseded by: #709

@jmehrens jmehrens closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2024
@jmehrens jmehrens self-assigned this Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: smtp wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants