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

Use non transitive R classes. #6635

Merged
merged 2 commits into from
May 2, 2023

Conversation

jaynewstrom-stripe
Copy link
Collaborator

@jaynewstrom-stripe jaynewstrom-stripe commented May 1, 2023

Summary

https://developer.android.com/build/optimize-your-build#use-non-transitive-r-classes

I used a modified version of the script referenced here to add the import aliases.

Motivation

Prepare for AGP 8

Testing

  • Added tests
  • Modified tests
  • Manually verified

@github-actions
Copy link
Contributor

github-actions bot commented May 1, 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 │   3.4 MiB │   3.4 MiB │ -342 B │   7.4 MiB │   7.4 MiB │ +132 B 
     arsc │   2.1 MiB │   2.1 MiB │    0 B │   2.1 MiB │   2.1 MiB │    0 B 
 manifest │   4.6 KiB │   4.6 KiB │    0 B │  22.3 KiB │  22.3 KiB │    0 B 
      res │ 869.1 KiB │ 869.1 KiB │    0 B │   1.3 MiB │   1.3 MiB │    0 B 
   native │   2.6 MiB │   2.6 MiB │    0 B │     6 MiB │     6 MiB │    0 B 
    asset │     3 MiB │     3 MiB │   -8 B │     3 MiB │     3 MiB │   -8 B 
    other │ 199.6 KiB │ 199.6 KiB │   +1 B │ 446.8 KiB │ 446.8 KiB │    0 B 
──────────┼───────────┼───────────┼────────┼───────────┼───────────┼────────
    total │  12.1 MiB │  12.1 MiB │ -349 B │  20.3 MiB │  20.3 MiB │ +124 B 

 DEX     │ old   │ new   │ diff              
─────────┼───────┼───────┼───────────────────
   files │     1 │     1 │   0               
 strings │ 36263 │ 36286 │ +23 (+29 -6)      
   types │ 12025 │ 12025 │   0 (+1 -1)       
 classes │ 10135 │ 10135 │   0 (+1 -1)       
 methods │ 53566 │ 53566 │   0 (+1721 -1721) 
  fields │ 34138 │ 34138 │   0 (+232 -232)   

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  291 │  291 │  0   
 entries │ 6939 │ 6939 │  0
APK
    compressed     │    uncompressed    │                                
──────────┬────────┼───────────┬────────┤                                
 size     │ diff   │ size      │ diff   │ path                           
──────────┼────────┼───────────┼────────┼────────────────────────────────
  3.4 MiB │ -342 B │   7.4 MiB │ +132 B │ ∆ classes.dex                  
  6.4 KiB │   -9 B │   6.3 KiB │   -9 B │ ∆ assets/dexopt/baseline.prof  
 62.7 KiB │   +2 B │ 140.9 KiB │    0 B │ ∆ META-INF/CERT.SF             
    755 B │   +1 B │     623 B │   +1 B │ ∆ assets/dexopt/baseline.profm 
 48.4 KiB │   -1 B │ 140.8 KiB │    0 B │ ∆ META-INF/MANIFEST.MF         
──────────┼────────┼───────────┼────────┼────────────────────────────────
  3.5 MiB │ -349 B │   7.7 MiB │ +124 B │ (total)
DEX
STRINGS:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   36263 │ 36286 │ +23 (+29 -6) 
  + A3
  + B3
  + C3
  + D3
  + E3
  + F3
  + G3
  + H3
  + I3
  + J3
  + K3
  + L3
  + Lde/b;
  + M3
  + context.getString(Stripe…pe_continue_button_label)
  + getString(StripeR.string.stripe_google_pay)
  + getString(StripeR.string.stripe_link)
  + q3
  + r3
  + resources.getString(Stri…tripe_setup_button_label)
  + s3
  + t3
  + u3
  + v3
  + w3
  + x3
  + y3
  + z3
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:6837996,r8-mode:full,version:4.0.52}
  
  - Lve/g;
  - context.getString(R.stri…pe_continue_button_label)
  - getString(R.string.stripe_google_pay)
  - getString(R.string.stripe_link)
  - resources.getString(R.st…tripe_setup_button_label)
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:4c5ecc4,r8-mode:full,version:4.0.52}
  

TYPES:

   old   │ new   │ diff      
  ───────┼───────┼───────────
   12025 │ 12025 │ 0 (+1 -1) 
  + Lde/b;
  
  - Lve/g;
  

METHODS:

   old   │ new   │ diff            
  ───────┼───────┼─────────────────
   53566 │ 53566 │ 0 (+1721 -1721) 
  + a7.d b(c0, float) → float
  + a9.f f0(o0, t0, f, e) → v1
  + ad.d A(i0, String, List)
  + ad.d A0(Spannable, d, int, int)
  + ad.d B(long, long) → e
  + ad.d B0(Spannable, Object, int, int)
  + ad.d C(int, int, ArrayList)
  + ad.d C0(Object, c, e)
  + ad.d D(e)
  + ad.d D0(w, w, e) → Object
  + ad.d E(String)
  + ad.d E0(int, i) → String
  + ad.d F(Object)
  + ad.d F0(int, Object[], i) → String
  + ad.d G(Object, String)
  + ad.d G0(g0) → ExtractedText
  + ad.d H(q) → boolean
  + ad.d H0(int) → String
  + ad.d I(String)
  + ad.d I0(long) → double
  + ad.d J(a2, v0, View, View, n1, boolean) → int
  + ad.d J0(Object) → Object
  + ad.d K(a2, v0, View, View, n1, boolean, boolean) → int
  + ad.d K0(k) → l
  + ad.d L(a2, v0, View, View, n1, boolean) → int
  + ad.d L0(h, Object, Object, e, d) → Object
  + ad.d M(int, long) → long
  + ad.d N(v) → a1
  + ad.d O(Object, d, e) → d
  + ad.d P(InputStream, String, e) → InputStream
  + ad.d Q(String) → String
  + ad.d R(ECPublicKey, PrivateKey) → SecretKeySpec
  + ad.d S(i) → b1
  + ad.d T(Map) → e
  + ad.d U(int, List) → int
  + ad.d V(i) → j
  + ad.d W(JSONObject) → d
  + ad.d X(View) → i0
  + ad.d Y(g, i, d) → Object
  + ad.d Z(a) → a
  + ad.d a(y0, p, boolean, i, int)
  + ad.d a0(a) → a
  + ad.d b(i, int)
  + ad.d b0(j) → l
  + ad.d c(y0, r, boolean, i, int)
  + ad.d c0(String, JSONObject) → String
  + ad.d d(float, float) → long
  + ad.d d0(String, JSONObject) → UUID
  + ad.d e(float, float) → long
  + ad.d e0(JSONObject, String, boolean) → boolean
  + ad.d f(Throwable, a, a, c, i, int)
  + ad.d f0(d) → d
  + ad.d g(m, i, i, int)
  + ad.d g0() → boolean
  + ad.d h(l, String, i, int)
  + ad.d h0(i) → k2
  + ad.d i(i, int)
  + ad.d i0(JSONObject) → p4
  + ad.d j(String, i, int, int)
  + ad.d j0(JSONObject) → g5
  + ad.d k(byte[], int, int)
  + ad.d k0() → c
  + ad.d l(a, h1, c, i, int)
  + ad.d l0(int, int, i) → String
  + ad.d m(int, byte[]) → int
  + ad.d m0(Object[], o, String, a, i, int) → Object
  + ad.d n(i, int)
  + ad.d n0(g2, b0)
  + ad.d o(v, s3, a, a, c, a, a, c, a, i, int)
  + ad.d o0(Context, int) → TypedValue
  + ad.d p0(Context, int, boolean) → boolean
  + ad.d q(l, k1, c, i, int, int)
  + ad.d q0(long, float, b) → float
  + ad.d r(y0, s, boolean, i, int)
  + ad.d r0(int, Context, String) → TypedValue
  + ad.d s(s, boolean, boolean, boolean, boolean, a, a, i, int)
  + ad.d s0(double) → int
  + ad.d t(String, l, boolean, i, int, int)
  + ad.d t0(float) → int
  + ad.d u(l, h, e, i, int, int)
  + ad.d u0(double) → long
  + ad.d v(int, int) → long
  + ad.d v0(boolean)
  + ad.d w(b, q, a, a, c, i, int)
  + ad.d w0(View, i0)
  + ad.d x(List, i, int)
  + ad.d x0(Spannable, long, int, int)
  + ad.d y(g, i, int)
  + ad.d y0(Spannable, long, int, int)
  + ad.d z(v, a, a, a, c, a, c, i, int)
  + ad.d z0(Spannable, long, b, int, int)
  + androidx.appcompat.widget.z0 I1(int)
  + androidx.appcompat.widget.z0 J1(Typeface)
  + androidx.emoji2.text.f Q0(Throwable)
  + androidx.emoji2.text.f T0(g)
  + androidx.emoji2.text.k a(a)
  + androidx.emoji2.text.o <init>(a, ThreadPoolExecutor)
  + androidx.emoji2.text.o Q0(Throwable)
  + androidx.emoji2.text.o T0(g)
  + androidx.emoji2.text.x a(a)
  + b1.b t() → f
  + b1.c t() → f
  + b1.c v(int, HashMap, n) → f
  + b1.d t() → f
  
...✂

@jaynewstrom-stripe jaynewstrom-stripe force-pushed the jaynewstrom/non-transitive-r branch from a5246fa to 34ad043 Compare May 1, 2023 19:59
@jaynewstrom-stripe jaynewstrom-stripe marked this pull request as ready for review May 1, 2023 21:14
@jaynewstrom-stripe jaynewstrom-stripe requested review from a team as code owners May 1, 2023 21:14
@jaynewstrom-stripe jaynewstrom-stripe force-pushed the jaynewstrom/non-transitive-r branch 2 times, most recently from 40e4faf to 84eae8a Compare May 2, 2023 15:18
@jaynewstrom-stripe jaynewstrom-stripe force-pushed the jaynewstrom/non-transitive-r branch from 84eae8a to 9ac2243 Compare May 2, 2023 15:31
@jaynewstrom-stripe jaynewstrom-stripe merged commit b5f9254 into master May 2, 2023
@jaynewstrom-stripe jaynewstrom-stripe deleted the jaynewstrom/non-transitive-r branch May 2, 2023 18:01
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.

2 participants