-
Notifications
You must be signed in to change notification settings - Fork 294
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
Crashes on API < 24 with new AGP that is needed for API 33 #242
Comments
|
@andrew-ld this is true, but because
|
there is a try catch in static initialization nv-websocket-client/src/main/java/com/neovisionaries/ws/client/SNIHelper.java Lines 34 to 44 in f9cc330
|
@andrew-ld as I wrote in the first message, that catch is useless, because NoClassDefFoundError is an Error and not an exception, so it will not catch it. |
I missed the point, you are right, it should be handled directly throwable to avoid future problems. |
@andrew-ld will you be able to add it or should I create a PR? It looks like the repository is dead... |
I download the source project add it to my project then skip the "initialize" method on API < 24 like
|
|
Linking to work done in #225
For some reason, AGP included these dependencies also for lower versions, but the newest build system removes them and we shouldn't call them on API < 24:
@TakahikoKawasaki this PR doesn't seem to fix the issue as
`private static void initialize() throws Exception
{
// Constructor which represents javax.net.ssl.SNIHostName(String).
// The class is available since Java 1.8 / Android API Level 24 (Android 7.0)
sSNIHostNameConstructor = Misc.getConstructor(
"javax.net.ssl.SNIHostName", new Class<?>[] { String.class });
is still called. This causes a crash on the newest AGP used with Android 33 - 7.3.x
java.lang.NoClassDefFoundError at javax.net.ssl.SNIServerName.<clinit>(Unknown Source) at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:308) at java.lang.Class.forName(Class.java:272)
and NoClassDefFoundError is an Error and not an exception
https://developer.android.com/reference/javax/net/ssl/SNIServerName was added with API 24
A fix is to either catch the error, or better prevent this code to run on API < 24
The text was updated successfully, but these errors were encountered: