I am trying to use Tyrus (org.glassfish.tyrus.bundles:tyrus-standalone-client:1.10) in Android. Here is my proguard related part:
-dontoptimize
-keepparameternames
-keepclassmembers,allowoptimization enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class org.glassfish.tyrus.** { *; }
-keep class org.glassfish.grizzly.** { *; }
-keep class javax.websocket.** { *; }
I make a call to ClientManager connectToServer and this method doesnt return and hangs.But it works if i disable proguard. How can i make it work in Android with proguard?
You need to add following line for the Fragment or Activity that use Tyrus
-keep,includedescriptorclasses class com.package.YourClass$* { *; }
For tyrus you need to add following lines
-keepattributes Signature,InnerClasses,*Annotation*
-keep,includedescriptorclasses class org.glassfish.tyrus.** { *; }
-keep,includedescriptorclasses class org.glassfish.grizzly.** { *; }
-keep,includedescriptorclasses class javax.websocket.** { *; }
By adding these lines, i managed to use Tyrus in Android. Here is a reference for Tyrus: https://blogs.oracle.com/PavelBucek/entry/reducing_websocket_client_jar_size