Status Update
Comments
za...@affirm.com <za...@affirm.com> #2
I am not sure I understand the use case. how can the benchmark be code to real world scenario when it's not possible to do right now ? which scenario is it ?
In any case, since this would be for benchmarking, this would clearly not be available through the public DSL. We should find a semi-private way of doing this (maybe the private variant API object could offer that functionality for instance or a property).
cl...@google.com <cl...@google.com> #3
We want benchmarks to measure code after Progaurd / R8, but it's not possible to turn that on for androidTests in library modules at the moment (to my knowledge?)
Benchmarks are also a public facing thing, but we have a plugin to help configure gradle builds for our users, so if support for this ends up in a private API, we could try to keep those usages localized to our code perhaps.
za...@affirm.com <za...@affirm.com> #4
Any update on the status of this request and when it can be supported?
Thanks,
Amanda
cl...@google.com <cl...@google.com> #5
this is not part of our OKR at this point so we are not talking soon. at first glance, we would need to simulate usage patterns to minify against and such, this seems substantial amount of work. there are not a lot of library module that have android tests, most only rely on unit-tests.
how important is this ? we are out of PM right now but I suspect the next step will be to negotiate with J. Eason and xav@ to scale a priority level.
za...@affirm.com <za...@affirm.com> #6
This is a high priority request for Compose, to enable their benchmarks to measure release accurate performance. (Micro) Benchmarks are library modules, as they don't need the complexity of multi-apk tests - they're self measuring APKs that depend on libraries. (d.android.com/benchmark)
there are not a lot of library module that have android tests, most only rely on unit-tests.
To clarify, this is for com.android.library
modules, not jars - I'd expect most of those to use android tests (all of the libraries in jetpack for example do).
we would need to simulate usage patterns to minify against and such, this seems substantial amount of work
Simulate usage patterns? I don't understand - the dev can themselves provide a keep rule for test infra / classes if necessary. Long term, keep rules should be provided by test libraries.
cl...@google.com <cl...@google.com> #7
We've been experimenting with ways to work around this for Compose. Performance results from R8 seem significantly different, and would enable us to measure much more accurately. I've tried to come up with a workaround using a com.android.app module, and while it almost works (and we can get measurements), it's extremely hacky and doesn't let us run tests anymore via Studio:
sg...@google.com <sg...@google.com> #8
Bumping this request, as Compose has recently had more interest in the ability to benchmark with and without R8 enabled.
We're fine if the default implementation doesn't work with minification (tree shaking) - we're happy to supply those rules ourselves, or simply evaluating with minification off to take advantage of other optimizations.
sa...@affirm.com <sa...@affirm.com> #9
Juan, this might be something to put on our OKR in the near future, I think you chat with Amanda to set the priority.
sg...@google.com <sg...@google.com> #10
Hey everyone, I am catching up on feature requests and saw this one. I'll schedule time for us to talk about this in a few days.
ap...@google.com <ap...@google.com> #11
Ivan, can you provide a rough estimate on how long this would take ?
ap...@google.com <ap...@google.com> #12
I think this is a duplicate of
My understanding of this feature request is the following:
- As a library author, I'd like to write microbenchmarks in my library subproject that measure performance of my library after it's been processed by R8 [1]
Chris/Dustin, is this correct? If [1] is correct, this is a duplicate of a duplicate of
ap...@google.com <ap...@google.com> #13
As a small correction, it's:
- As a user of microbenchmarks, I'd like to measure performance of code processed by R8
For a bit more context, we generally recommend library and app devs create a completely new, empty library module to add microbenchmarks to, e.g. mylib/src/androidTest/
.
For this reason, we don't particularly care about the minified main library component from the same module.
This librarytest-only focus does have the downside that app devs must pull code into a library to be microbenchmarks, and maybe that could be something improved if there was a good minification story across the test and app module boundary, but that's a separate (but related) concern for the future.
For right now, we care about libraries with empty main directories running R8 on the code in androidTest and its dependencies.
ap...@google.com <ap...@google.com> #14
Thanks for clarifying this. In terms of benchmarking R8-processed library there seem to be two options:
- minify both library and its usages together (in this case they are coming from microbenchmark tests), and collect performance data
- run R8 on the library only, and use non-minified (i.e. public library APIs) from microbenchmark tests to collect performance data; this is captured in
.http://b/263197720
IMO both 1) and 2) are valid use-cases. For 1) you'd like to see how your library behaves given concrete API usages, while 2) tests library "full-surface".
Could 1) also be modelled with an application that depends on the library, uses some APIs, and then microbenchmark tests from its androidTest are doing the profiling?
ap...@google.com <ap...@google.com> #15
For 1) you'd like to see how your library behaves given concrete API usages,
Yes, this is it exactly. We want 1, assuming that it means all of the library dependencies of the benchmark and it's androidTest code would be run through R8 together.
As there's no content in my-benchmark/src/
, I don't think 2 helps our issue.
Could 1) also be modelled with an application that depends on the library, uses some APIs, and then microbenchmark tests from its androidTest are doing the profiling?
We experimented with this years ago when we started the project, it could work conceptually, but the issue is that the androidTest dir build wasn't factored into the tree shaking step, so every test had to be accompanied by manual keep rules/annotations to the code it invodes. I'd be fine having to specify keep rules for JUnit and @Test methods, but if we wanted libraries to be minified, they had to be in the app, and the benchmark had to cross that test/apk boundary constantly.
Another option we explored was declaring each test twice (as a @Keep
function in src/
and wrapper in androidTest/
so Studio could see/run the test method). which technically worked, but was similarly cumbersome.
ap...@google.com <ap...@google.com> #16
I think I have all requirements right now.
- library androidTest: there is a single APK AGP produces, and this would allow you to run R8 on both androidTest code and its runtime classpath (which includes all of its dependencies&main). Every class from your tests would be an entry point. Also, when
main
component of the library is processed with R8, we'd apply its mapping file. - application androidTest: we produce 2 APKs, so R8 runs on androidTest code and its runtime classpath (includes only its dependencies, and all duplicate libraries from main are removed). Every class from your tests would be an entry point. Also, when
main
component of the application is processed with R8, we'd apply its mapping file.
Is this a correct summary? If so, we can de-duplicate?
P.S. Related to issues with taking test usages into account when running R8 on application code, this is
ap...@google.com <ap...@google.com> #17
Yes, thanks, duping against
ap...@google.com <ap...@google.com> #18
IIUC, for library androidTest, we are going to run R8 for its program code(e.g. my-benchmark/src/
suppose it is not empty) together with androidTest code and other dependencies, right?
If so, I think
enable it on the test apk for libraries. I do not want progaurd to run on the library itself, however.
which seems to suggest the program code should not be minified.
sg...@google.com <sg...@google.com> #19
I do not want progaurd to run on the library itself, however.
My reading of this statement on that bug is that they don't want the library's .aar or .jar to be minified (as part of the actual library build), but they DO want the library minified as part of the library test build, which is why I agreed with the duping suggestion.
From a later comment, comment13:
The original comment is pretty clear that it's for libraries which do not want to run R8 on their main code but want to on their test APK to validate things like the embedded rules.
Testing embedded rules implies that the .aar/.jar from the library won't be minifed, but they want to test an environment where the library is minified when embedded in an apk, via the tests.
sa...@affirm.com <sa...@affirm.com> #20
Thanks for the insights, Chris. Can you also clarify what are the embedded rules? keep rules shipped with the library?
sg...@google.com <sg...@google.com> #21
Yes, rules shipped with the library.
ri...@google.com <ri...@google.com> #22
When it comes to introducing the new dsl, we are considering making it more specific, rather than using "minify". So I would love to confirm with you what you want r8 to do. e.g. codeShrinking, obfuscation?
ri...@google.com <ri...@google.com> #23
We want all of the r8 functionality, since we want to be able to mirror the behavior in apps (either for correctness testing or for performance testing).
My suggestion would be for library test configuration to match app DSL, for consistently and simplicity. As things change in the app r8 dsl, we could have the library r8 dsl mirror it (e.g.
ap...@google.com <ap...@google.com> #24
Project: r8
Branch: main
Author: Rico Wind <
Link:
Update enclosing method signature when normalizing protos
Expand for full commit details
Update enclosing method signature when normalizing protos
Bug: b/353279141
Change-Id: I58740138a75bd7052f624aaa1a17cdcb23990dcd
Files:
- M
src/main/java/com/android/tools/r8/optimize/proto/ProtoNormalizer.java
- M
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: b74c404673dd18104acdfb6f4cd3a296e33e93e7
Date: Fri Dec 06 13:00:04 2024
ap...@google.com <ap...@google.com> #25
Project: r8
Branch: main
Author: Rico Wind <
Link:
Reproduction for dangling reference in enclosing method annotation
Expand for full commit details
Reproduction for dangling reference in enclosing method annotation
Bug: b/353279141
Change-Id: I8b6bebe9d7bad8b93393c6ae03c513f512918a15
Files:
- A
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: e1545336c3fbe376ef07a7f169ca9557ddc05789
Date: Thu Dec 05 18:14:18 2024
ap...@google.com <ap...@google.com> #26
Project: r8
Branch: 8.8
Author: Rico Wind <
Link:
Version 8.8.23
Expand for full commit details
Version 8.8.23
Bug: b/353279141
Change-Id: I2cd1ff305de54c7bb83283f2b9f4091179249e21
Files:
- M
src/main/java/com/android/tools/r8/Version.java
Hash: c64c58c8f4ad7800f003d7fbfd77ced99f62d968
Date: Mon Dec 09 06:23:54 2024
ap...@google.com <ap...@google.com> #27
Project: r8
Branch: 8.8
Author: Rico Wind <
Link:
Reproduction for dangling reference in enclosing method annotation
Expand for full commit details
Reproduction for dangling reference in enclosing method annotation
Bug: b/353279141
Change-Id: I8b6bebe9d7bad8b93393c6ae03c513f512918a15
Files:
- A
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: bb97bdd15576363526a9017a7950698e0e3e6260
Date: Mon Dec 09 06:23:23 2024
ap...@google.com <ap...@google.com> #28
Project: r8
Branch: 8.8
Author: Rico Wind <
Link:
Update enclosing method signature when normalizing protos
Expand for full commit details
Update enclosing method signature when normalizing protos
Bug: b/353279141
Change-Id: I58740138a75bd7052f624aaa1a17cdcb23990dcd
Files:
- M
src/main/java/com/android/tools/r8/optimize/proto/ProtoNormalizer.java
- M
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: c37f8e4500a3e750e46da5f2052af4d57664ca05
Date: Mon Dec 09 06:23:40 2024
ap...@google.com <ap...@google.com> #29
Project: r8
Branch: 8.7
Author: Rico Wind <
Link:
Version 8.7.25
Expand for full commit details
Version 8.7.25
Bug: b/353279141
Change-Id: I3a350fdd1112e6471cf5bd14490576bfc24c395d
Files:
- M
src/main/java/com/android/tools/r8/Version.java
Hash: 83e86425dcd10ea9275f6e0b8fdcdfacefdd7714
Date: Mon Dec 09 06:25:25 2024
ap...@google.com <ap...@google.com> #30
Project: r8
Branch: 8.7
Author: Rico Wind <
Link:
Update enclosing method signature when normalizing protos
Expand for full commit details
Update enclosing method signature when normalizing protos
Bug: b/353279141
Change-Id: I58740138a75bd7052f624aaa1a17cdcb23990dcd
Files:
- M
src/main/java/com/android/tools/r8/optimize/proto/ProtoNormalizer.java
- M
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: dfd259fdd322623337cdf0237518ede415ef1a38
Date: Mon Dec 09 06:25:18 2024
ap...@google.com <ap...@google.com> #31
Project: r8
Branch: 8.7
Author: Rico Wind <
Link:
Reproduction for dangling reference in enclosing method annotation
Expand for full commit details
Reproduction for dangling reference in enclosing method annotation
Bug: b/353279141
Change-Id: I8b6bebe9d7bad8b93393c6ae03c513f512918a15
Files:
- A
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: b58b2c76ef0f479c034a07525f7360bcdd953180
Date: Mon Dec 09 06:25:10 2024
ap...@google.com <ap...@google.com> #32
Project: r8
Branch: 8.6
Author: Rico Wind <
Link:
Version 8.6.38
Expand for full commit details
Version 8.6.38
Bug: b/353279141
Change-Id: Iccaa9fa23aaeb9b13cbea1159afd8d1238948b2a
Files:
- M
src/main/java/com/android/tools/r8/Version.java
Hash: a99c18e769a2b345417a85ac5126539143a6ccdc
Date: Mon Dec 09 06:27:54 2024
ap...@google.com <ap...@google.com> #33
Project: r8
Branch: 8.6
Author: Rico Wind <
Link:
Update enclosing method signature when normalizing protos
Expand for full commit details
Update enclosing method signature when normalizing protos
Bug: b/353279141
Change-Id: I58740138a75bd7052f624aaa1a17cdcb23990dcd
Files:
- M
src/main/java/com/android/tools/r8/optimize/proto/ProtoNormalizer.java
- M
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: 11bdb4fb992bacd5d8ec14d225aa11a4ad2022ca
Date: Mon Dec 09 06:27:48 2024
ap...@google.com <ap...@google.com> #34
Project: r8
Branch: 8.6
Author: Rico Wind <
Link:
Reproduction for dangling reference in enclosing method annotation
Expand for full commit details
Reproduction for dangling reference in enclosing method annotation
Bug: b/353279141
Change-Id: I8b6bebe9d7bad8b93393c6ae03c513f512918a15
Files:
- A
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: 180c4eb0b3df82adeb672a26cf5631596dc79644
Date: Mon Dec 09 06:27:41 2024
ap...@google.com <ap...@google.com> #35
Project: r8
Branch: 8.5
Author: Rico Wind <
Link:
Reproduction for dangling reference in enclosing method annotation
Expand for full commit details
Reproduction for dangling reference in enclosing method annotation
Bug: b/353279141
Change-Id: I8b6bebe9d7bad8b93393c6ae03c513f512918a15
Files:
- A
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: c8daa7ebd1c35abc62b70db88a9417c70110c869
Date: Mon Dec 09 06:29:12 2024
ap...@google.com <ap...@google.com> #36
Project: r8
Branch: 8.5
Author: Rico Wind <
Link:
Update enclosing method signature when normalizing protos
Expand for full commit details
Update enclosing method signature when normalizing protos
Bug: b/353279141
Change-Id: I58740138a75bd7052f624aaa1a17cdcb23990dcd
Files:
- M
src/main/java/com/android/tools/r8/optimize/proto/ProtoNormalizer.java
- M
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: 82702b3ac17616c81bed8acf8eb35a196b4670f1
Date: Mon Dec 09 06:29:18 2024
ap...@google.com <ap...@google.com> #37
Project: r8
Branch: 8.5
Author: Rico Wind <
Link:
Version 8.5.49
Expand for full commit details
Version 8.5.49
Bug: b/353279141
Change-Id: Ic4e17c9754350d55add8faea527641ffc567751f
Files:
- M
src/main/java/com/android/tools/r8/Version.java
Hash: b21776e0fd79f3a210940ae580896f12ab82a4fb
Date: Mon Dec 09 06:29:24 2024
ap...@google.com <ap...@google.com> #38
Project: r8
Branch: 8.8
Author: Rico Wind <
Link:
Reproduction for dangling reference in enclosing method annotation
Expand for full commit details
Reproduction for dangling reference in enclosing method annotation
Bug: b/353279141
Change-Id: I8b6bebe9d7bad8b93393c6ae03c513f512918a15
Files:
- A
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: bb97bdd15576363526a9017a7950698e0e3e6260
Date: Mon Dec 09 06:23:23 2024
ap...@google.com <ap...@google.com> #39
Project: r8
Branch: 8.8
Author: Rico Wind <
Link:
Update enclosing method signature when normalizing protos
Expand for full commit details
Update enclosing method signature when normalizing protos
Bug: b/353279141
Change-Id: I58740138a75bd7052f624aaa1a17cdcb23990dcd
Files:
- M
src/main/java/com/android/tools/r8/optimize/proto/ProtoNormalizer.java
- M
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: c37f8e4500a3e750e46da5f2052af4d57664ca05
Date: Mon Dec 09 06:23:40 2024
ap...@google.com <ap...@google.com> #40
Project: r8
Branch: 8.7
Author: Rico Wind <
Link:
Update enclosing method signature when normalizing protos
Expand for full commit details
Update enclosing method signature when normalizing protos
Bug: b/353279141
Change-Id: I58740138a75bd7052f624aaa1a17cdcb23990dcd
Files:
- M
src/main/java/com/android/tools/r8/optimize/proto/ProtoNormalizer.java
- M
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: dfd259fdd322623337cdf0237518ede415ef1a38
Date: Mon Dec 09 06:25:18 2024
ap...@google.com <ap...@google.com> #41
Project: r8
Branch: 8.7
Author: Rico Wind <
Link:
Reproduction for dangling reference in enclosing method annotation
Expand for full commit details
Reproduction for dangling reference in enclosing method annotation
Bug: b/353279141
Change-Id: I8b6bebe9d7bad8b93393c6ae03c513f512918a15
Files:
- A
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: b58b2c76ef0f479c034a07525f7360bcdd953180
Date: Mon Dec 09 06:25:10 2024
ap...@google.com <ap...@google.com> #42
Project: r8
Branch: 8.6
Author: Rico Wind <
Link:
Update enclosing method signature when normalizing protos
Expand for full commit details
Update enclosing method signature when normalizing protos
Bug: b/353279141
Change-Id: I58740138a75bd7052f624aaa1a17cdcb23990dcd
Files:
- M
src/main/java/com/android/tools/r8/optimize/proto/ProtoNormalizer.java
- M
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: 11bdb4fb992bacd5d8ec14d225aa11a4ad2022ca
Date: Mon Dec 09 06:27:48 2024
ap...@google.com <ap...@google.com> #43
Project: r8
Branch: 8.6
Author: Rico Wind <
Link:
Reproduction for dangling reference in enclosing method annotation
Expand for full commit details
Reproduction for dangling reference in enclosing method annotation
Bug: b/353279141
Change-Id: I8b6bebe9d7bad8b93393c6ae03c513f512918a15
Files:
- A
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: 180c4eb0b3df82adeb672a26cf5631596dc79644
Date: Mon Dec 09 06:27:41 2024
ap...@google.com <ap...@google.com> #44
Project: r8
Branch: 8.8
Author: Rico Wind <
Link:
Reproduction for dangling reference in enclosing method annotation
Expand for full commit details
Reproduction for dangling reference in enclosing method annotation
Bug: b/353279141
Change-Id: I8b6bebe9d7bad8b93393c6ae03c513f512918a15
Files:
- A
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: bb97bdd15576363526a9017a7950698e0e3e6260
Date: Mon Dec 09 06:23:23 2024
ap...@google.com <ap...@google.com> #45
Project: r8
Branch: 8.8
Author: Rico Wind <
Link:
Update enclosing method signature when normalizing protos
Expand for full commit details
Update enclosing method signature when normalizing protos
Bug: b/353279141
Change-Id: I58740138a75bd7052f624aaa1a17cdcb23990dcd
Files:
- M
src/main/java/com/android/tools/r8/optimize/proto/ProtoNormalizer.java
- M
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: c37f8e4500a3e750e46da5f2052af4d57664ca05
Date: Mon Dec 09 06:23:40 2024
ap...@google.com <ap...@google.com> #46
Project: r8
Branch: 8.7
Author: Rico Wind <
Link:
Update enclosing method signature when normalizing protos
Expand for full commit details
Update enclosing method signature when normalizing protos
Bug: b/353279141
Change-Id: I58740138a75bd7052f624aaa1a17cdcb23990dcd
Files:
- M
src/main/java/com/android/tools/r8/optimize/proto/ProtoNormalizer.java
- M
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: dfd259fdd322623337cdf0237518ede415ef1a38
Date: Mon Dec 09 06:25:18 2024
ap...@google.com <ap...@google.com> #47
Project: r8
Branch: 8.7
Author: Rico Wind <
Link:
Reproduction for dangling reference in enclosing method annotation
Expand for full commit details
Reproduction for dangling reference in enclosing method annotation
Bug: b/353279141
Change-Id: I8b6bebe9d7bad8b93393c6ae03c513f512918a15
Files:
- A
src/test/java/com/android/tools/r8/regress/Regress353279141.java
Hash: b58b2c76ef0f479c034a07525f7360bcdd953180
Date: Mon Dec 09 06:25:10 2024
ri...@google.com <ri...@google.com> #48
This is fixed on main and backported on all release branches back to 8.5 (where this was seen).
You should be able to temporarily update your R8 version by doing something like (remove again when you update to the a new AGP version or you will be stuck on an old R8 version):
pluginManagement {
buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath("com.android.tools:r8:8.5.49")
}
}
}
an...@google.com <an...@google.com> #49
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 Ladybug Feature Drop | 2024.2.2 Patch 1
- Android Gradle Plugin 8.8.1
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!
Description
We have recently started experiencing an intermittent crash right as the release build of our app opens. From one commit to the next the issue will be present/not present, all changes that appear unrelated to this class. Setting
-dontoptimize
appears to fix the issue (though we are not certain, given that the issue comes and goes from commit to commit)We have the following in our proguard files, and have confirmed when inspecting our DEX file that
LazyThreadSafetyMode
is present (screenshot attached).-keep class kotlin.** { *; }