Status Update
Comments
ri...@google.com <ri...@google.com> #2
Fix (pending) is I2c2dc7b600603ee430fd0d91b23d52ea8aa29ca9.
ch...@google.com <ch...@google.com> #3
ch...@google.com <ch...@google.com> #4
#sdkmanager --package_file=${PATH_WORKSPACE}/packages
while read p; do echo "y" | sdkmanager "${p}"; done <${PATH_WORKSPACE}/packages
ze...@google.com <ze...@google.com> #5
ch...@google.com <ch...@google.com>
ap...@google.com <ap...@google.com> #6
ap...@google.com <ap...@google.com> #7
ap...@google.com <ap...@google.com> #8
ap...@google.com <ap...@google.com> #9
ap...@google.com <ap...@google.com> #10
```
(15:58:11) C02W513SHTD8:files aso$ /opt/android-sdk-macosx/tools/bin/sdkmanager --version
26.1.1
(15:58:17) C02W513SHTD8:files aso$ /opt/android-sdk-macosx/tools/bin/sdkmanager --install --package_file=package_file
Warning: Unknown argument --package_file=package_file
```
ap...@google.com <ap...@google.com> #11
ap...@google.com <ap...@google.com> #12
ap...@google.com <ap...@google.com> #13
ap...@google.com <ap...@google.com> #14
ri...@google.com <ri...@google.com> #15
br...@snapchat.com <br...@snapchat.com> #16
Has anyone re-tried it?
We switched back to RUN sdkmanager --package_file=$ANDROID_HOME/packages.txt
in our Dockerfile back in March of 2021.
ri...@google.com <ri...@google.com> #17
For what it's worth, I did a quick test with the latest CLI: 11076708 (
./sdkmanager --sdk_root="../sdk" --package_file=deps.txt
Deps.txt:
platform-tools
extras;google;instantapps
build-tools;35.0.0-rc3
So perhaps this is now resolved? I haven't tried it with more packages
br...@snapchat.com <br...@snapchat.com> #18
Iirc, The issue we ran into using the rule you suggested was that we were using the type in a generic for Gson deserialization but never referencing the type directly. so the type would be erased in the generic to Object leading to the Gson code to crash.
Morten suggested the rule we have now which somehow ensures the type wasn't removed. The rule is quite complex so I'm not exactly sure why it works better. I think there's a test case that captures this behavior I believe
sg...@google.com <sg...@google.com> #19
Benjamin is right that
-if class *
-keepclasseswithmembers,allowshrinking,allowobfuscation class <1> {
<init>(...);
@com.google.gson.annotations.SerializedName <fields>;
}
require that both at least one <init>
and a @com.google.gson.annotations.SerializedName
annotated field is present, whereas the other will keep the <init>
's for all classes with a @com.google.gson.annotations.SerializedName
annotated field.
Note that you should probably change <init>(...)
to <init>()
to match the
ap...@google.com <ap...@google.com> #20
Branch: main
commit 17024bf79ef3ea7a81018e3bd7b67358e328c3d3
Author: Rico Wind <ricow@google.com>
Date: Fri Dec 22 11:04:46 2023
Add tests illustrating star pattern conditional keep issue with inlining
In the case where we have a simple method that we inline we don't keep the specified constructor
Only two cases in ConditionalRuleOnMemberWithKeepInitTest show the wrong behaviour.
For fields and simple value return we correctly keep the constructor and class
Bug: 316100042
Change-Id: I1cfd6443d0406451b4bfed0628b86c083d7fa8c3
A src/test/java/com/android/tools/r8/shaking/ifrule/ConditionalRuleOnMemberFieldWithKeepInitTest.java
A src/test/java/com/android/tools/r8/shaking/ifrule/ConditionalRuleOnMemberWithKeepInitSimpleInlineTest.java
A src/test/java/com/android/tools/r8/shaking/ifrule/ConditionalRuleOnMemberWithKeepInitTest.java
ch...@google.com <ch...@google.com> #21
It seems we mark 184,827 classes as ineligible for class merging due to -if
rules. Many of these classes are completely unrelated to gson (e.g., androidx.annotation.Keep
). I will try to diagnose why these classes are being marked as ineligible.
ap...@google.com <ap...@google.com> #22
Branch: main
commit b1cff385b38d81de3d1d0e72d4f7909287ed69bd
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 09:39:24 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
ap...@google.com <ap...@google.com> #23
Branch: main
commit a5e7061f4a2f921ac43cc0346214a6ea48d8d569
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Thu Jan 04 20:47:00 2024
Support for writing classes with no horizontal class merging
Bug:
Change-Id: Ibe423ea333c9fe39dc8adb3c99a14acd456aa5cc
M src/main/java/com/android/tools/r8/shaking/KeepInfoCollection.java
ap...@google.com <ap...@google.com> #24
Branch: 8.0
commit 2a22e5f13cf41a884eaaecb35ce95e481181491d
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:50:02 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
ap...@google.com <ap...@google.com> #25
Branch: 8.0
commit 2580e83d60200be531665ea79cc9f2e801dc7611
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:50:12 2024
Version 8.0.73
Bug:
Change-Id: I85b39889751befda6389d93ca94877a0de44e097
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #26
Branch: 8.1
commit fd78a229f564edac5c45b439175ebf735beedf19
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:49:29 2024
Version 8.1.76
Bug:
Change-Id: I81c5552c52710dfbef0df6210840b522b449733d
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #27
Branch: 8.1
commit 147f78856f224d82adff82724e1af1cc9cb6e7af
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:49:17 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
ap...@google.com <ap...@google.com> #28
Branch: 8.2
commit 7d8f81c4b3df410491209d8fb289a09182c7e53c
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:46:29 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
ap...@google.com <ap...@google.com> #29
Branch: 8.2
commit f917b7eb61e4642ff0d71965e7dd6bc908b200a7
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:48:09 2024
Version 8.2.44
Bug:
Change-Id: I189134160bfdd43adc5e8f632ef34fff7b4b6527
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #30
Branch: 8.3
commit a0d9ae1d9dfa9709a862914e4ca2a96f9fd4cbf1
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:45:21 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
ap...@google.com <ap...@google.com> #31
Branch: 8.3
commit b6dca00a5c0b171213cdf2cfec732b34494c7395
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:45:33 2024
Version 8.3.28
Bug:
Change-Id: I0fb14fefa0ea0e36ad79eabc57626fbf09bb7015
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #32
Branch: 8.0
commit 2a22e5f13cf41a884eaaecb35ce95e481181491d
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:50:02 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
ap...@google.com <ap...@google.com> #33
Branch: 8.1
commit 147f78856f224d82adff82724e1af1cc9cb6e7af
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:49:17 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
ap...@google.com <ap...@google.com> #34
Branch: 8.2
commit 7d8f81c4b3df410491209d8fb289a09182c7e53c
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:46:29 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
ap...@google.com <ap...@google.com> #35
Branch: 8.0
commit 2a22e5f13cf41a884eaaecb35ce95e481181491d
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:50:02 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
ap...@google.com <ap...@google.com> #36
Branch: 8.1
commit 147f78856f224d82adff82724e1af1cc9cb6e7af
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:49:17 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
ch...@google.com <ch...@google.com> #37
Ben, can you check if updating to 8.3.28 resolves the issue?
You may still see a small regression, since -if
rules correctly, but hopefully not anywhere near the regression you reported here.
ap...@google.com <ap...@google.com> #38
Branch: 8.0
commit 2a22e5f13cf41a884eaaecb35ce95e481181491d
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Fri Jan 05 10:50:02 2024
Do not filter member rules in synthetic -nohorizontalclassmerging rule
Bug:
Change-Id: I4e0e83b6350b60cf295c46475cb81c9990881ca8
M src/main/java/com/android/tools/r8/shaking/ProguardIfRule.java
br...@snapchat.com <br...@snapchat.com> #39
With R8 8.3.28, we observe app size reduced by 90KB.
br...@snapchat.com <br...@snapchat.com> #40
Btw, Soren when I replaced our Gson rules with the rules from upstream, our app size increases by 600KB.
Here are the rules we are using for GSON:
##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep,allowobfuscation class * implements com.google.gson.TypeAdapterFactory
-keep,allowobfuscation class * implements com.google.gson.JsonSerializer
-keep,allowobfuscation class * implements com.google.gson.JsonDeserializer
# @SerializedName annotation
-keep @interface com.google.gson.annotations.SerializedName { *; }
# Do not strip any field that is annotated with @SerializedName
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# Ensure init methods are preserved if class has @SerializedName annotations
# Ref: https://partnerissuetracker.corp.google.com/issues/280658459#comment4
-if class * {
@com.google.gson.annotations.SerializedName <fields>;
}
-keepclasseswithmembers,allowobfuscation class <1> {
<init>(...);
}
-if class *
-keepclasseswithmembers,allowshrinking,allowobfuscation class <1> {
@com.google.gson.annotations.SerializedName <fields>;
}
##---------------End: proguard configuration for Gson ----------
Note, when doing this comparison I didn't switch the <init>(...)
with <init>()
yet.
ch...@google.com <ch...@google.com> #41
Thanks for the update. I will mark this as fixed then.
an...@google.com <an...@google.com> #42
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Iguana | 2023.2.1 Beta 2
- Android Gradle Plugin 8.3.0-beta02
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
an...@google.com <an...@google.com> #43
The fixes for this issue are now also available in:
- Android Studio Hedgehog | 2023.1.1 Patch 2
- Android Gradle Plugin 8.2.2
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
so...@google.com <so...@google.com> #44
Comment added by automation: A postmortem has been automatically requested for this issue. Please author a postmortem on IRM. See go/android-postmortem-guidance for more context and details, including how to handle the case when this issue does not need a postmortem. If you have any questions not answered by go/android-postmortem-guidance, please email android-hygiene-tpm@, instead of reassigning the fixed bug. Thank you.
an...@google.com <an...@google.com> #45
Further fixes for this issue are now available in:
- Android Studio Iguana | 2023.2.1 RC 1
- Android Gradle Plugin 8.3.0-rc01
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Description
Background
While upgrading from 8.1.56 to R8 8.3.21 we are observing an ~1.5MB app size increase.
Note, I tried R8 8.2.24 a while back and it was only ~70KB decrease (so we skipped that version) so the regression would be something introduced after that.
I'll share the compiler dumps over email.