'How to ignore specific package in proguard

I am trying to build (release) an app and the app crashes due to the fact that there are generated methods that are being obfuscated by ProGuard. How can I ignore all of them in the release build?

I have tried to add the following in the proguard-rules.pro:

-keep public class !*Service_Impl.kt

but seems that it doesnt work. The classes that I want to ignore are named as

C1Service_Impl
C2Service_Impl

and so on and so forth, located in the generated java folder

com.application.myapp.persistence.services.C1Service
com.application.myapp.persistence.services.C2Service

Thanks in advance.



Solution 1:[1]

You don't specify in what way it doesn't work. Your configuration keeps the names of all public classes in the specified package:

-keep public class com.application.myapp.persistence.services.*

The following configuration keeps the names of all public classes in the specified package and its subpackages:

-keep public class com.application.myapp.persistence.services.**

The following configuration keeps the names of all public/protected classes/fields/methods in the specified package and its subpackages:

-keep public class com.application.myapp.persistence.services.** {
  public protected *;
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 S_i_l_e_n_t C_o_d_e_r