Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Issue with proguard #53

Open
AlirezaIvaz opened this issue Dec 12, 2021 · 2 comments
Open

Issue with proguard #53

AlirezaIvaz opened this issue Dec 12, 2021 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@AlirezaIvaz
Copy link
Contributor

AlirezaIvaz commented Dec 12, 2021

Proguard/R8 inadvertently deletes some required classes that seem extra. So far I have only found a few classes for which this happens. These classes are used in xml code and will probably be deleted in Proguard/R8 for this reason.

This is not a bug in the library, and I will simply state what I found and the solution in this issue.

If you use the following code (of course not only that, there may be other codes as well) with Proguard/R8, your app will probably crash:

<de.dlyt.yanndroid.oneui.view.NestedScrollView
    ...
    app:layout_behavior="@string/sesl_appbar_scrolling_view_behavior">
    ...
</de.dlyt.yanndroid.oneui.view.NestedScrollView>

Note: Because Proguard/R8 is disabled in debug mode, your app may work fine but will crash in release mode.

To avoid deleting required classes so as not to damage the app, you must add these lines to the app/proguard-rules.pro file (or in proguard-rules.pro file for each module in which you use this library):

# One UI Design Library (de.dlyt.yanndroid.oneui)
-keep class de.dlyt.yanndroid.oneui.** { *; }
-keep class androidx.appcompat.widget.Sesl** { *; }
-keep class android.view.WindowInsetsController { *; }

If anything new is reported on this issue or other related pages, I will update this rules.

@Yanndroid
Copy link
Member

Thanks for reporting this issue and also providing a solution, I appreciate it. I'll mention it in the readme in the next update.

@Yanndroid Yanndroid added the documentation Improvements or additions to documentation label Dec 27, 2021
@TenSeventy7
Copy link

TenSeventy7 commented Feb 22, 2022

It might be necessary to whitelist more components starting 2.3.0 since they also cause crashes with 'Class not found' errors. This is what my app uses.

# One UI Design Library (de.dlyt.yanndroid.oneui)
-keep class de.dlyt.yanndroid.oneui.** { *; }
-keep class androidx.appcompat.widget.Sesl** { *; }
-keep class android.view.WindowInsetsController { *; }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Development

No branches or pull requests

3 participants