-keep class * implements androidx.versionedparcelable.VersionedParcelable -keep public class android.support.**Parcelizer { *; } -keep public class androidx.**Parcelizer { *; } -keep public class androidx.versionedparcelable.ParcelImpl -keepattributes AnnotationDefault, RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations, RuntimeVisibleTypeAnnotations -keepclassmembers enum androidx.lifecycle.Lifecycle$Event { ; } -keep !interface * implements androidx.lifecycle.LifecycleObserver { } -keep class * implements androidx.lifecycle.GeneratedAdapter { (...); } -keepclassmembers class ** { @androidx.lifecycle.OnLifecycleEvent *; } # this rule is need to work properly when app is compiled with api 28, see b/142778206 # Also this rule prevents registerIn from being inlined. -keepclassmembers class androidx.lifecycle.ReportFragment$LifecycleCallbacks { *; } # Never inline methods, but allow shrinking and obfuscation. -keepclassmembernames,allowobfuscation,allowshrinking class androidx.core.view.ViewCompat$Api* { ; } -keepclassmembernames,allowobfuscation,allowshrinking class androidx.core.view.WindowInsetsCompat$*Impl* { ; } -keepclassmembernames,allowobfuscation,allowshrinking class androidx.core.app.NotificationCompat$*$Api*Impl { ; } -keepclassmembernames,allowobfuscation,allowshrinking class androidx.core.os.UserHandleCompat$Api*Impl { ; } -keepclassmembernames,allowobfuscation,allowshrinking class androidx.core.widget.EdgeEffectCompat$Api*Impl { ; } # Copyright (C) 2019 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -keepclassmembers,allowobfuscation class * implements androidx.savedstate.SavedStateRegistry$AutoRecreated { (); } # Copyright (C) 2015 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # When layoutManager xml attribute is used, RecyclerView inflates #LayoutManagers' constructors using reflection. -keep public class * extends androidx.recyclerview.widget.RecyclerView$LayoutManager { public (android.content.Context, android.util.AttributeSet, int, int); public (); } -keepclassmembers class androidx.recyclerview.widget.RecyclerView { public void suppressLayout(boolean); public boolean isLayoutSuppressed(); } -keepclassmembers,allowobfuscation class * extends androidx.lifecycle.ViewModel { (); } -keepclassmembers,allowobfuscation class * extends androidx.lifecycle.AndroidViewModel { (android.app.Application); } -keepclassmembers,allowobfuscation class * extends androidx.lifecycle.ViewModel { (androidx.lifecycle.SavedStateHandle); } -keepclassmembers,allowobfuscation class * extends androidx.lifecycle.AndroidViewModel { (android.app.Application,androidx.lifecycle.SavedStateHandle); } # Copyright (C) 2020 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # The default FragmentFactory creates Fragment instances using reflection -if public class ** extends androidx.fragment.app.Fragment -keepclasseswithmembers,allowobfuscation public class <1> { public (); } # Copyright (C) 2016 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # keep setters in VectorDrawables so that animations can still work. -keepclassmembers class androidx.vectordrawable.graphics.drawable.VectorDrawableCompat$* { void set*(***); *** get*(); } # Copyright (C) 2017 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Keep a field in transition that is used to keep a reference to weakly-referenced object -keepclassmembers class androidx.transition.ChangeBounds$* extends android.animation.AnimatorListenerAdapter { androidx.transition.ChangeBounds$ViewBounds mViewBounds; } # It's important that we preserve initializer names, given they are used in the AndroidManifest.xml. -keepnames class * extends androidx.startup.Initializer # These Proguard rules ensures that ComponentInitializers are are neither shrunk nor obfuscated, # and are a part of the primary dex file. This is because they are discovered and instantiated # during application startup. -keep class * extends androidx.startup.Initializer { # Keep the public no-argument constructor while allowing other methods to be optimized. (); } -assumenosideeffects class androidx.startup.StartupLogger { public static ; } # this rule is need to work properly when app is compiled with api 28, see b/142778206 -keepclassmembers class * extends androidx.lifecycle.EmptyActivityLifecycleCallbacks { *; } # Copyright (C) 2016 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # CoordinatorLayout resolves the behaviors of its child components with reflection. -keep public class * extends androidx.coordinatorlayout.widget.CoordinatorLayout$Behavior { public (android.content.Context, android.util.AttributeSet); public (); } # Make sure we keep annotations for CoordinatorLayout's DefaultBehavior and ViewPager's DecorView -keepattributes AnnotationDefault, RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations, RuntimeVisibleTypeAnnotations # Copyright (C) 2018 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # aapt is not able to read app::actionViewClass and app:actionProviderClass to produce proguard # keep rules. Add a commonly used SearchView to the keep list until b/109831488 is resolved. -keep class androidx.appcompat.widget.SearchView { (...); } # Never inline methods, but allow shrinking and obfuscation. -keepclassmembernames,allowobfuscation,allowshrinking class androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper$Impl* { ; } # Copyright (C) 2015 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # CoordinatorLayout resolves the behaviors of its child components with reflection. -keep public class * extends androidx.coordinatorlayout.widget.CoordinatorLayout$Behavior { public (android.content.Context, android.util.AttributeSet); public (); } # Make sure we keep annotations for CoordinatorLayout's DefaultBehavior -keepattributes RuntimeVisible*Annotation* # Copyright (C) 2018 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # AppCompatViewInflater reads the viewInflaterClass theme attribute which then # reflectively instantiates MaterialComponentsViewInflater using the no-argument # constructor. We only need to keep this constructor and the class name if # AppCompatViewInflater is also being kept. -if class androidx.appcompat.app.AppCompatViewInflater -keep class com.google.android.material.theme.MaterialComponentsViewInflater { (); } # Copyright (C) 2020 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # A rule that will keep classes that implement SidecarInterface$SidecarCallback if Sidecar seems # be used. See b/157286362 and b/165268619 for details. # TODO(b/208543178) investigate how to pass header jar to R8 so we don't need this rule -if class androidx.window.layout.SidecarCompat { public setExtensionCallback(androidx.window.layout.ExtensionInterfaceCompat$ExtensionCallbackInterface); } -keep class androidx.window.layout.SidecarCompat$TranslatingCallback, androidx.window.layout.SidecarCompat$DistinctSidecarElementCallback { public onDeviceStateChanged(androidx.window.sidecar.SidecarDeviceState); public onWindowLayoutChanged(android.os.IBinder, androidx.window.sidecar.SidecarWindowLayoutInfo); } # Copyright (C) 2019 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NavArgsLazy creates NavArgs instances using reflection -if public class ** implements androidx.navigation.NavArgs -keepclassmembers public class <1> { ** fromBundle(android.os.Bundle); } # Retain the @Navigator.Name annotation on each subclass of Navigator. # R8 full mode only retains annotations on items matched by a -keep rule, # hence the extra -keep rule for the subclasses of Navigator. # # A -keep rule for the Navigator.Name annotation class is not required # since the annotation is referenced from the code. -keepattributes RuntimeVisibleAnnotations -keep,allowobfuscation,allowshrinking class * extends androidx.navigation.Navigator # Copyright (C) 2019 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # setProgress is called via an ObjectAnimator in AbstractAppBarOnDestinationChangedListener -keepclassmembers class androidx.appcompat.graphics.drawable.DrawerArrowDrawable { void setProgress(float); } # Copyright (C) 2017 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Prevent Parcelable objects from being removed or renamed. -keep class android.support.v4.media.** implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } # Prevent Parcelable objects from being removed or renamed. -keep class androidx.media.** implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; }