21

What are the ProGuard rules for these dependencies?

compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
AL.
  • 36,815
  • 10
  • 142
  • 281
Mi_Dhah
  • 519
  • 1
  • 7
  • 18

1 Answers1

46

Firebase uses the consumerProguardFiles feature to automatically include the appropriate ProGuard if you're using Gradle, meaning you don't need to manually include anything.

If you need to manually apply the proguard rules, you can extract the proguard.txt file from each AAR file.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • 1
    This is buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } – Mi_Dhah Jan 08 '17 at 23:26
  • How can I extract the proguard.txt file from each AAR file. – Mi_Dhah Jan 08 '17 at 23:27
  • You're using Gradle, so everything you need is included automatically. There's nothing you need to add. – ianhanniballake Jan 08 '17 at 23:27
  • AAR files can be opened in any program that can open zip files. – ianhanniballake Jan 08 '17 at 23:28
  • but I used dex2jar-2.0 to chek the class after the signature, as an example, if I do not put -keep public class com.google.ads.** { public *; } the class will convert to a , b and c for google.ads ,correct me If I wrong – Mi_Dhah Jan 08 '17 at 23:38
  • So? Those classes can be renamed safely, otherwise there'd be a -keep in the included ProGuard files. – ianhanniballake Jan 09 '17 at 00:18
  • I need the -keep to include in the ProGuard files. for the classes that I mentioned above, I used [ -keepnames class com.firebase.** { *; } ] but still the classes for firebase showing like a ,b . any suggestion? – Mi_Dhah Jan 09 '17 at 00:29
  • No, you don't need any additional keep rules. The ones that are required for the app to work are already included. It is 100% totally and completely expected that almost all of the classes appear as a.b.c, etc. – ianhanniballake Jan 09 '17 at 00:30
  • so I don't need to use -keepnames class com.firebase.** { *; } ? – Mi_Dhah Jan 09 '17 at 00:39
  • No, obviously not. You don't need any additional lines in your ProGuard files if you are using Gradle. – ianhanniballake Jan 09 '17 at 00:40
  • 1
    how to fixe `[R8]: Shaking error: Missing method in com.google.firebase.iid.zzau: void ()` – Hanzala Jun 29 '19 at 05:34
  • The URL is broken – Karatekid430 Jan 31 '23 at 07:39