Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed keep-all proguard rules in favor of the minimal required ones. #6227

Merged
merged 10 commits into from
Feb 27, 2023

Conversation

carlosmuvi-stripe
Copy link
Collaborator

@carlosmuvi-stripe carlosmuvi-stripe commented Feb 17, 2023

Summary

  • Remove keep-all rule
  • Adds R8 full-mode to example app release builds
  • Add required keep rules:
    • Example apps: Retrofit
    • Connections SDK: Mavericks

Motivation

https://jira.corp.stripe.com/browse/MOBILESDK-950

Testing

  • Added tests
  • Modified tests
  • Manually verified - verified all critical flows across SDKs.

Changelog

@emerge-tools
Copy link

emerge-tools bot commented Feb 17, 2023

📏 Size Analysis

Total download size 3.8 MB | This change: ⬇️ -636.4 kB (-14.4%)

Image of diff

🗂 See size breakdown
Item Download size
Stripe Identity Example/base-master.apk/dex/androidx.constraintlayout/motion/androidx.constraintlayout.motion.widget ⬇️ 39.5 kB
Stripe Identity Example/base-master.apk/dex/com.stripe/android/android.identity/com.stripe.android.identity.ui ⬇️ 34.3 kB
➕ Stripe Identity Example/base-master.apk/dex/com.stripe/android/android.uicore/com.stripe.android.uicore.elements 🔺 28.2 kB
Stripe Identity Example/base-master.apk/dex/com.google/android/android.material/com.google.android.material.appbar 🔺 26.6 kB
Stripe Identity Example/base-master.apk/dex/androidx.compose/foundation/text/androidx.compose.foundation.text.selection ⬇️ 20.1 kB
Stripe Identity Example/base-master.apk/dex/androidx.camera/core/impl/utils/androidx.camera.core.impl.utils.executor 🔺 20.0 kB
Stripe Identity Example/base-master.apk/dex/androidx.constraintlayout/androidx.constraintlayout.widget 🔺 19.3 kB
Stripe Identity Example/base-master.apk/dex/androidx.compose/ui/input/androidx.compose.ui.input.key 🔺 18.7 kB
Stripe Identity Example/base-master.apk/dex/com.stripe/android/android.identity/example/com.stripe.android.identity.example.ui ⬇️ 13.3 kB
Stripe Identity Example/base-master.apk/dex/com.stripe/android/android.camera/framework/com.stripe.android.camera.framework.util ⬇️ 12.4 kB
Stripe Identity Example/base-master.apk/dex/com.stripe/android/android.identity/networking/com.stripe.android.identity.networking.models ⬇️ 11.4 kB
Stripe Identity Example/base-master.apk/dex/androidx.compose/ui/graphics/vector/androidx.compose.ui.graphics.vector.compat ⬇️ 11.3 kB
Stripe Identity Example/base-master.apk/dex/com.stripe/android/android.identity/com.stripe.android.identity.navigation ⬇️ 10.7 kB
Stripe Identity Example/base-master.apk/dex/com.stripe/android/android.core/com.stripe.android.core.networking ⬇️ 10.6 kB
Stripe Identity Example/base-master.apk/dex/androidx.compose/ui/androidx.compose.ui.node ⬇️ 9.6 kB
Stripe Identity Example/base-master.apk/dex/com.google/android/android.material/com.google.android.material.floatingactionbutton ⬇️ 9.4 kB
Stripe Identity Example/base-master.apk/dex/androidx.navigation/androidx.navigation.compose ⬇️ 8.4 kB
Stripe Identity Example/base-master.apk/dex/com.google/android/android.material/com.google.android.material.datepicker ⬇️ 8.1 kB
➖ Stripe Identity Example/base-master.apk/dex/androidx.constraintlayout/core/motion ⬇️ 7.8 kB
Stripe Identity Example/base-master.apk/dex/kotlinx.serialization/kotlinx.serialization.internal ⬇️ 7.6 kB

🔎 See the full size analysis (adbe87f) merging into master (2ca901f)

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2023

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │            compressed            │          uncompressed           
          ├───────────┬───────────┬──────────┼──────────┬───────────┬──────────
 APK      │ old       │ new       │ diff     │ old      │ new       │ diff     
──────────┼───────────┼───────────┼──────────┼──────────┼───────────┼──────────
      dex │   5.8 MiB │     4 MiB │ -1.8 MiB │ 15.1 MiB │   8.9 MiB │ -6.2 MiB 
     arsc │   2.1 MiB │   2.1 MiB │      0 B │  2.1 MiB │   2.1 MiB │      0 B 
 manifest │   4.4 KiB │   4.4 KiB │      0 B │   21 KiB │    21 KiB │      0 B 
      res │   1.1 MiB │   1.1 MiB │      0 B │  1.9 MiB │   1.9 MiB │      0 B 
   native │   2.6 MiB │   2.6 MiB │      0 B │    6 MiB │     6 MiB │      0 B 
    asset │     3 MiB │     3 MiB │ -2.1 KiB │    3 MiB │     3 MiB │ -2.1 KiB 
    other │ 206.1 KiB │ 205.8 KiB │   -301 B │  454 KiB │ 453.6 KiB │   -351 B 
──────────┼───────────┼───────────┼──────────┼──────────┼───────────┼──────────
    total │  14.8 MiB │    13 MiB │ -1.8 MiB │ 28.6 MiB │  22.4 MiB │ -6.2 MiB 

         │           raw           │                 unique                  
         ├────────┬───────┬────────┼────────┬───────┬────────────────────────
 DEX     │ old    │ new   │ diff   │ old    │ new   │ diff                   
─────────┼────────┼───────┼────────┼────────┼───────┼────────────────────────
   files │      2 │     1 │     -1 │        │       │                        
 strings │  93119 │ 44882 │ -48237 │  77988 │ 44882 │ -33106 (+6562 -39668)  
   types │  24541 │ 13813 │ -10728 │  22233 │ 13813 │  -8420 (+6290 -14710)  
 classes │  19981 │ 11810 │  -8171 │  19981 │ 11810 │  -8171 (+5640 -13811)  
 methods │ 106329 │ 61925 │ -44404 │ 102056 │ 61925 │ -40131 (+43132 -83263) 
  fields │ 102911 │ 36530 │ -66381 │ 101669 │ 36530 │ -65139 (+29809 -94948) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  333 │  333 │  0   
 entries │ 6871 │ 6871 │  0
APK
      compressed       │      uncompressed      │                                                                       
──────────┬────────────┼───────────┬────────────┤                                                                       
 size     │ diff       │ size      │ diff       │ path                                                                  
──────────┼────────────┼───────────┼────────────┼───────────────────────────────────────────────────────────────────────
          │   -2.4 MiB │           │   -6.5 MiB │ - classes2.dex                                                        
    4 MiB │ +547.3 KiB │   8.9 MiB │ +315.4 KiB │ ∆ classes.dex                                                         
  6.2 KiB │     -2 KiB │   6.1 KiB │     -2 KiB │ ∆ assets/dexopt/baseline.prof                                         
          │     -259 B │           │      -52 B │ - META-INF/services/kotlinx.coroutines.internal.MainDispatcherFactory 
          │     -250 B │           │      -54 B │ - META-INF/services/kotlinx.coroutines.CoroutineExceptionHandler      
    177 B │     +177 B │       5 B │       +5 B │ + META-INF/services/kotlinx.coroutines.internal.q                     
    161 B │     +161 B │       5 B │       +5 B │ + META-INF/services/kotlinx.coroutines.a0                             
 56.2 KiB │      -72 B │ 146.4 KiB │     -130 B │ ∆ META-INF/MANIFEST.MF                                                
 65.3 KiB │      -63 B │ 146.4 KiB │     -130 B │ ∆ META-INF/CERT.SF                                                    
    759 B │      -58 B │     627 B │      -58 B │ ∆ assets/dexopt/baseline.profm                                        
    202 B │       +5 B │      56 B │       +5 B │ ∆ META-INF/services/java.security.Provider                            
──────────┼────────────┼───────────┼────────────┼───────────────────────────────────────────────────────────────────────
  4.1 MiB │   -1.8 MiB │   9.2 MiB │   -6.2 MiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff                  
  ───────┼───────┼───────────────────────
   77988 │ 44882 │ -33106 (+6562 -39668) 
  +  does not allow nullable values
  +  does not implement Parcelable or Serializable.
  +  does not implement Parcelable.
  +  for permission_rationale_shown
  +  has null value but is not nullable.
  +  is an Enum. You should use EnumType instead.
  +  is not supported for navigation arguments.
  +  on 
  + , clippingEnabled=true, fishEyeEnabled=false)
  + , pathEffect=null)
  + , shippingInformationValidator=null, shippingMethodsFactory=null, windowFlags=
  + , slide=null, changeSize=
  + , typeData=null, amount=
  + Argument with type 
  + Builder()
              .s…uri }
              .intent
  + CHARACTER_PALETTE
  + COPY
  + CUT
  + Could not retrieve font from family.
  + DELETE_FROM_LINE_START
  + DELETE_NEXT_CHAR
  + DELETE_NEXT_WORD
  + DELETE_PREV_CHAR
  + DELETE_PREV_WORD
  + DELETE_TO_LINE_END
  + DESELECT
  + DIL
  + DefaultDateTypeAdapter(
  + FZLI
  + FractionalThreshold(fraction=0.5)
  + HOME
  + Height
  + IIIILZ
  + ILIIJ
  + JFJ
  + LEFT_CHAR
  + LEFT_WORD
  + LFJ
  + LFLLL
  + LIJLLL
  + LINE_END
  + LINE_LEFT
  + LINE_RIGHT
  + LINE_START
  + LLIIIIIIIIIIII
  + LLILZI
  + LLJFIFLI
  + LLJJI
  + LLJJJJJJJLI
  + LLJLI
  + LLLF
  + LLLLFF
  + LLLLLLLILL
  + LLLLLLZI
  + LLLLZZZLLLLLI
  + LLLZZLI
  + LLZI
  + LLZLZZI
  + LZLI
  + LZLLLL
  + La/b;
  + La5/v;
  + La5/w;
  + La6/a0;
  + La6/b0;
  + La6/c0;
  + La6/d0;
  + La6/e0;
  + La6/e;
  + La6/f0;
  + La6/f;
  + La6/g0;
  + La6/g;
  + La6/h0;
  + La6/h;
  + La6/i0;
  + La6/i;
  + La6/j0;
  + La6/j;
  + La6/k;
  + La6/l;
  + La6/m;
  + La6/n;
  + La6/o;
  + La6/p;
  + La6/q;
  + La6/r;
  + La6/s;
  + La6/t;
  + La6/u;
  + La6/v;
  + La6/w;
  + La6/x;
  + La6/y;
  + La6/z;
  + La7/b;
  + La7/c;
  + La8/e;
  + La8/f;
  + La8/g;
  + La8/h;
  + La8/i;
  + La8/j;
  + La8/k;
  + La8/l;
  + La8/m;
  + La8/n;
  + La8/o;
  + La8/p;
  + La9/b;
  + La9/c;
  + La9/d;
  + La9/e;
  + La9/f;
  + La9/g;
  + La9/h;
  + La9/i;
  + Lab/c;
  + Lab/d;
  + Lab/e;
  + Lab/f;
  + Lab/g;
  + Lab/h;
  + Lab/i;
  + Lab/j;
  + Lab/k;
  + Lab/l;
  + Lab/m;
  + Lab/n;
  + Lab/o;
  + Lac/c;
  + Lac/d;
  + Lac/e;
  + Lac/f;
  + Lac/g;
  + Lae/d;
  + Lae/e;
  + Lae/f;
  + Lae/g;
  + Lae/h;
  + Lae/i;
  + Lae/j;
  + Lae/k;
  + Lae/l;
  + Laf/c;
  + Laf/d;
  + Laf/e;
  + Laf/f;
  + Laf/g;
  + Lag/a;
  + Lag/b;
  + Lag/c;
  + Lag/d;
  + Lah/a;
  + Lah/b;
  + Lai/a;
  + Laj/a;
  + Laj/b;
  + Landroidx/activity/q;
  + Landroidx/activity/r;
  + Landroidx/activity/result/k;
  + Landroidx/activity/result/l;
  + Landroidx/activity/s;
  + Landroidx/appcompat/widget/a3;
  + Landroidx/appcompat/widget/a4;
  + Landroidx/appcompat/widget/b3;
  + Landroidx/appcompat/widget/b4;
  + Landroidx/appcompat/widget/c3;
  + Landroidx/appcompat/widget/c4;
  + Landroidx/appcompat/widget/d3;
  + Landroidx/appcompat/widget/d4;
  + Landroidx/appcompat/widget/e3;
  + Landroidx/appcompat/widget/e4;
  + Landroidx/appcompat/widget/f3;
  + Landroidx/appcompat/widget/f4;
  + Landroidx/appcompat/widget/g3;
  + Landroidx/appcompat/widget/g4;
  + Landroidx/appcompat/widget/h3;
  + Landroidx/appcompat/widget/h4;
  + Landroidx/appcompat/widget/i2;
  + Landroidx/appcompat/widget/i3;
  + Landroidx/appcompat/widget/i4;
  + Landroidx/appcompat/widget/j2;
  + Landroidx/appcompat/widget/j3;
  + Landroidx/appcompat/widget/j4;
  + Landroidx/appcompat/widget/k2;
  + Landroidx/appcompat/widget/k3;
  + Landroidx/appcompat/widget/k4;
  + Landroidx/appcompat/widget/l2;
  + Landroidx/appcompat/widget/l3;
  + Landroidx/appcompat/widget/l4;
  + Landroidx/appcompat/widget/m2;
  + Landroidx/appcompat/widget/m3;
  + Landroidx/appcompat/widget/m4;
  + Landroidx/appcompat/widget/n2;
  + Landroidx/appcompat/widget/n3;
  + Landroidx/appcompat/widget/n4;
  + Landroidx/appcompat/widget/o2;
  + Landroidx/appcompat/widget/o3;
  + Landroidx/appcompat/widget/o4;
  + Landroidx/appcompat/widget/p2;
  + Landroidx/appcompat/widget/p3;
  + Landroidx/appcompat/widget/p4;
  + Landroidx/appcompat/widget/q2;
  + Landroidx/appcompat/widget/q3;
  + Landroidx/appcompat/widget/q4;
  + Landroidx/appcompat/widget/r2;
  + Landroidx/appcompat/widget/r3;
  + Landroidx/appcompat/widget/r4;
  + Landroidx/appcompat/widget/s2;
  + Landroidx/appcompat/widget/s3;
  + Landroidx/appcompat/widget/s4;
  + Landroidx/appcompat/widget/t2;
  + Landroidx/appcompat/widget/t3;
  + Landroidx/appcompat/widget/u2;
  + Landroidx/appcompat/widget/u3;
 
...✂

@carlosmuvi-stripe carlosmuvi-stripe marked this pull request as draft February 18, 2023 00:04
@ccen-stripe
Copy link
Collaborator

hmm this might cause identity app to crash in flow due to json parsing, I think it might impact other apps, could you try test your app's prod build?
I think we could limit the classes being kept in the mean time

@jaynewstrom-stripe
Copy link
Collaborator

This definitely caused problems with payment sheet :D

I'm working on fixing some of the issues to make it work in the payments space. See #6237

I don't think we'll be able to take this PR as is, we should probably do it module by module, as we test them.

@carlosmuvi-stripe
Copy link
Collaborator Author

carlosmuvi-stripe commented Feb 22, 2023

It was just a testing branch it definitely won't work as is :)

@carlosmuvi-stripe carlosmuvi-stripe marked this pull request as ready for review February 24, 2023 22:43
@carlosmuvi-stripe carlosmuvi-stripe changed the title [WIP] Delete proguard rules. Remove keep-all proguard rule. Feb 25, 2023
@jameswoo-stripe
Copy link
Contributor

Can we add some motivating factors and or an issue tagged here? It would be good to keep track of this history.

@jaynewstrom-stripe
Copy link
Collaborator

To keep this updated, we've tested everything in our sample apps, we're still waiting on updating the 3ds2 rules to be less aggressive at keeping classes (will be done in a follow up). But we've already made huge improvements, and we should release what we have!

@carlosmuvi-stripe
Copy link
Collaborator Author

Can we add some motivating factors and or an issue tagged here? It would be good to keep track of this history.

@jameswoo-stripe created an epic to keep track of this and other SDK reduction efforts (and a task for this specific work)

@carlosmuvi-stripe carlosmuvi-stripe merged commit bac7d74 into master Feb 27, 2023
@carlosmuvi-stripe carlosmuvi-stripe deleted the test/delete-proguard-rules branch February 27, 2023 19:16
@carlosmuvi-stripe carlosmuvi-stripe changed the title Remove keep-all proguard rule. Removed keep-all proguard rules in favor of the minimal required ones. Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants