Harsh Shah
Harsh Shah

Reputation: 2332

How to keep external libraries in proguard android

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?

Upvotes: 3

Views: 3724

Answers (2)

Anand
Anand

Reputation: 927

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.

Upvotes: 3

Ravi Kumar
Ravi Kumar

Reputation: 4528

Have you tried the below?

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

Upvotes: 3

Related Questions