How to keep external libraries in proguard android Code Answer

Hi I am using proguard in my android application and I am also using external libs and getting error for the class of that lib. How shoud I add this lib in proguard rules.

How I have added lib in the gradle:

 implementation "io.crossbar.autobahn:autobahn-android:${versionAutobahn}"

Here is what I have tried in proguard but not working for me I have also used -keep but no help

-dontwarn io.crossbar.autobahn-autobahn-android   
-dontwarn io.crossbar.autobahn.wamp.Client
-keep class autobahn.** { *; }
-keep class io.crossbar.** { *; }

How should I keep this lib in proguard?

Answer

You need to use -keep to keep the class from any packages, something like:

-keep class io.crossbar.** { *; }

-dontwarn will only ignore the warnings. With, -keep you can keep any classes, class fields, and methods.

For more detailed usage check: ProGuard manual

Also, there is a feature request on GitHub for this repo to support ProGuard, here.

Related Posts

© No Copyrights, All Questions are retrived from public domain.
Tutorial Guruji