Solution 1 :
The correct rule for keeping everything in package in.myapplication.app.samplePackage
and all subpackages is:
-keep class in.myapplication.app.samplePackage.** {*;}
The warning you see could be a false negative, see issue 153616200.
Solution 2 :
On Android Studio 4.0 and above double asterisks ()** won’t compile anymore. So if you want to fix this error and exclude sub-packages do it like this
-keep class in.myapplication.app.samplePackage.*.* {*;}
this will exclude the packages inside samplePackage
as well
Problem :
I have my project package name as
in.myapplication.app
and I have a package which contains several packages as well like this
in.myapplication.app.samplePackage
in.myapplication.app.samplePackage.SubPackage
Now I want to exclude all the classes present inside samplePackage
package including subpackage classes also. I tried this keep rule inside progaurd file
-keep class in.myapplication.app.samplePackage.*{*;}
But it only allows the classes that are in samplePackage
and not in samplePackage.SubPackage
I have checked similar questions
- How to keep/exclude a particular package path when using proguard?
- Make Proguard completely ignore package
Nothing working and tried to use these
-keep class in.myapplication.app.samplePackage.** {*;}
But it’s showing me a warning
Unresolved reference name in shrinker config file
So, How to exclude package name and sub package name while using progaurd In Android Studio?
Comments
Comment posted by Style-7
This works for me -keep class in.myapplication.app.samplePackage.** { *; }
Comment posted by AgentP
@Style-7 which android version are you using? I am using android studio 4.0 I presume that it exists on 4.0 and above
Comment posted by stackoverflow.com/a/4904402/9365212
See Daniel’s comment on this answer
Comment posted by issue 153616200
The issue in Android Studio 4.0 is in the IDE which wrongly flags the
Comment posted by AgentP
@sgjesse So it’s the IDE problem then?
Comment posted by sgjesse
Yes the IDE will make a class like