ChipsLayoutManager icon indicating copy to clipboard operation
ChipsLayoutManager copied to clipboard

ProGuard and Orientation annotation

Open Krisztiaan opened this issue 8 years ago • 10 comments

dependency loaded from jCenter, ProGuard complains that it can not find Orientation

Krisztiaan avatar Feb 21 '17 14:02 Krisztiaan

I also found these warning, the logs are below:

Warning:com.beloo.widget.chipslayoutmanager.ChipsLayoutManager: can't find referenced class com.beloo.widget.chipslayoutmanager.Orientation
Warning:com.beloo.widget.chipslayoutmanager.ChipsLayoutManager$Builder: can't find referenced class com.beloo.widget.chipslayoutmanager.Orientation
Warning:com.beloo.widget.chipslayoutmanager.IChipsLayoutManagerContract: can't find referenced class com.beloo.widget.chipslayoutmanager.Orientation
Warning:com.beloo.widget.chipslayoutmanager.IStateHolder: can't find referenced class com.beloo.widget.chipslayoutmanager.Orientation

I'm trying to keep everything related to ChipsLayoutManager with the following annotations:

-keep class com.beloo.widget.chipslayoutmanager.* { *; }
-keep class com.beloo.widget.chipslayoutmanager.*$* { *; }

icarovirtual avatar Feb 21 '17 19:02 icarovirtual

I made some changes and by using the configuration below I do not get any ProGuard warnings.

-keep class com.beloo.widget.chipslayoutmanager.* { *; }
-keep class com.beloo.widget.chipslayoutmanager.** { *; }
-keep class com.beloo.widget.chipslayoutmanager.*$* { *; }
-keep class RestrictTo.*
-keep class RestrictTo.**
-keep class RestrictTo.*$*

icarovirtual avatar Feb 21 '17 19:02 icarovirtual

These are very vague rules. It would be sufficient, if the jCenter library just contained the Orientations.java. I imported just that file in the project, and it works without any hassle.

Krisztiaan avatar Feb 22 '17 11:02 Krisztiaan

Rules provided by @ihhcarus are not working on my case. I use -dontwarn rule to fix this temporarily.

-dontwarn com.beloo.widget.chipslayoutmanager.Orientation

But do you guys know the cause of this issue? Is it because the Orientation annotation is not kept when building the jar? There is no Orientation annotation in the jar file. And why there's no problem for building debug variant (of the app includes ChipsLayoutManager)?

egistli avatar Mar 08 '17 10:03 egistli

One workaround for now, would be adding the Orientation.java to your project yourself, to the correct package.

Krisztiaan avatar Mar 08 '17 12:03 Krisztiaan

Yes @egistli, what I posted was also not working that well for me. I didn't comment back here again but I ended up using -dontwarn too to fix this temporarily.

icarovirtual avatar Mar 08 '17 13:03 icarovirtual

@Krisztiaan Add the Orientation.java to the app project will resolve this issue but I prefer to keep third-party packages/files out of the app project and only referenced them via build.gradle.

egistli avatar Mar 09 '17 01:03 egistli

Same problem here, is there a fix planned in a future version?

galex avatar Jan 16 '18 09:01 galex

I got the same problem when trying to sign and build my application. The solution was to add "-dontwarn com.beloo.widget.chipslayoutmanager. **" in my file "proguard-rules.pro" Once this was done, it worked.

Regards.

cristianireyes avatar Dec 12 '18 16:12 cristianireyes

@cristianireyes would it affect any functionality?

ajay-aravind avatar Sep 04 '19 07:09 ajay-aravind