Android R8 not keep fragment used in FragmentContainerView

393 views Asked by At

My class of fragment is removed after build because of R8, but it is used in main_activity.xml in "androidx.fragment.app.FragmentContainerView". On open the app release i have error of class not found

1

There are 1 answers

4
ianhanniballake On

As per this issue, automatically generating the proper keep rules for fragments used in FragmentContainerView requires you to use Android Gradle Plugin 4.1-alpha04 or higher.

Therefore you can either upgrade your Android Gradle Plugin version or add @Keep to manually keep your fragment.