After searching on different platforms we didn’t find any help regarding this issue. we are using Smack version 4.4.4 in my app, Everything is working fine in dev flavor when proguard is not enabled but when we are making release build WebView is not working because our proguard is active and minifyEnabled and shrinkResources property is true.
The issue related directly with smack 4.4.4 because when we remove proguard rule of smackx WebView starts to work.
we are using this proguard rule for smack 4.4.4
-keep class org.jivesoftware.smackx.** { ; }
-keep class org.jivesoftware.smack.* { *; }
Did you follow instructions in this link?
I don’t remember what I did in the other App using Smack. But I don’t remember if I had to define rules anywhere
try to follow configurations explained in the link and remove the rules and see if it helps
After following the above configuration i am getting this exception while initializing smack
java.lang.ExceptionInInitializerError
at iv.x.b(Smack.java:38)
at iv.x.a(Smack.java:64)
at iv.n.<clinit>(ConnectionConfiguration.java:115)
at ow.l.y(XMPPTCPConnectionConfiguration.java:64)
at cp.k0.B(XmppConnectionManager.kt:195)
at cp.k0.t(XmppConnectionManager.kt:166)
at cp.k0.c(XmppConnectionManager.kt:49)
at cp.k0$c.l(XmppConnectionManager.kt:93)
at ds.a.g(ContinuationImpl.kt:33)
at ss.u0.run(DispatchedTask.kt:106)
at xs.a.u(CoroutineScheduler.kt:571)
at xs.a$b.c(CoroutineScheduler.kt:738)
at xs.a$b.m(CoroutineScheduler.kt:678)
at xs.a$b.run(CoroutineScheduler.kt:665)
Caused by: java.lang.IllegalStateException: Could not parse Smack configuration file
at iv.c0.<clinit>(SmackInitialization.java:106)
at iv.x.b(Smack.java:38)
at iv.x.a(Smack.java:64)
at iv.n.<clinit>(ConnectionConfiguration.java:115)
at ow.l.y(XMPPTCPConnectionConfiguration.java:64)
at cp.k0.B(XmppConnectionManager.kt:195)
at cp.k0.t(XmppConnectionManager.kt:166)
at cp.k0.c(XmppConnectionManager.kt:49)
at cp.k0$c.l(XmppConnectionManager.kt:93)
at ds.a.g(ContinuationImpl.kt:33)
at ss.u0.run(DispatchedTask.kt:106)
at xs.a.u(CoroutineScheduler.kt:571)
at xs.a$b.c(CoroutineScheduler.kt:738)
at xs.a$b.m(CoroutineScheduler.kt:678)
at xs.a$b.run(CoroutineScheduler.kt:665)
Caused by: java.lang.ClassNotFoundException: org.jivesoftware.smack.initializer.VmArgInitializer
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at iv.c0.a(SmackInitialization.java:210)
at iv.c0.b(SmackInitialization.java:190)
at iv.c0.d(SmackInitialization.java:164)
at iv.c0.c(SmackInitialization.java:154)
at iv.c0.<clinit>(SmackInitialization.java:103)
at iv.x.b(Smack.java:38)
at iv.x.a(Smack.java:64)
at iv.n.<clinit>(ConnectionConfiguration.java:115)
at ow.l.y(XMPPTCPConnectionConfiguration.java:64)
at cp.k0.B(XmppConnectionManager.kt:195)
at cp.k0.t(XmppConnectionManager.kt:166)
at cp.k0.c(XmppConnectionManager.kt:49)
at cp.k0$c.l(XmppConnectionManager.kt:93)
at ds.a.g(ContinuationImpl.kt:33)
at ss.u0.run(DispatchedTask.kt:106)
at xs.a.u(CoroutineScheduler.kt:571)
at xs.a$b.c(CoroutineScheduler.kt:738)
at xs.a$b.m(CoroutineScheduler.kt:678)
at xs.a$b.run(CoroutineScheduler.kt:665)
@FaizanAbbas72 were you able to find a solution? I am facing this same exact problem, but I do not see the ClassNotFoundException - I just see WebViews not working.
This is a very strange error.
There are no exceptions in our app, but the WebView chromium side is complaining about handshake exception.
03-02 09:25:27.510 11988 12269 E chromium: [ERROR:ssl_client_socket_impl.cc(996)] handshake failed; returned -1, SSL error code 1, net_error -2
03-02 09:25:27.512 11988 11988 W System.err: chromium: onReceivedError: net::ERR_FAILED code=-1
If I removing smack or revert to Smack 4.3.1 - then this exact code works.
The WebView appears to be using some other Bouncy Castle implementation when smack is included:
| ±-- org.igniterealtime.smack:smack-openpgp:4.4.4
| | ±-- org.igniterealtime.smack:smack-core:4.4.4 ()
| | ±-- org.igniterealtime.smack:smack-extensions:4.4.4
| | | ±-- org.igniterealtime.smack:smack-core:4.4.4 ()
| | | — org.igniterealtime.smack:smack-im:4.4.4 ()
| | ±-- org.igniterealtime.smack:smack-experimental:4.4.4
| | | ±-- org.igniterealtime.smack:smack-core:4.4.4 ()
| | | ±-- org.igniterealtime.smack:smack-extensions:4.4.4 (*)
| | | — org.hsluv:hsluv:0.2
| | — org.pgpainless:pgpainless-core:0.1.0
| | ±-- org.bouncycastle:bcprov-jdk15on:1.65
| | ±-- com.google.code.findbugs:jsr305:3.0.2
| | — org.bouncycastle:bcpg-jdk15on:1.65
| | — org.bouncycastle:bcprov-jdk15on:1.65
Yep, I also suspect that this is caused by Smack installing Bouncy Castle’s security provider in the first place. You could try either, undoing the changes that Smack does in the security provider setting or, remove smack-openpgp from you classpath (because this is the component of Smack that modifies the security provider). Note that this behavior is removed in Smack’s master branch: