Status Update
Comments
ga...@linecorp.com <ga...@linecorp.com> #2
Any plans to support this?
ga...@linecorp.com <ga...@linecorp.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3-adaptive-navigation-suite:1.4.0-alpha07
androidx.compose.material3:material3-adaptive-navigation-suite-android:1.4.0-alpha07
be...@google.com <be...@google.com>
ma...@google.com <ma...@google.com>
ma...@google.com <ma...@google.com> #5
I only tested current versions of baseline profile gradle plugin, so 1.2.4 and 1.3.0-alpha4.
Proguard configuration files seem to be already copied in the benchmark and baseline profile build types for agp >= 8.1.0.
For agp 8.0 there seems to be an issue where accessing both minifyEnabled
and postprocessing
options is going to crash, so I'm not sure we can do much there.
I created a pr to add tests to ensure this behavior works aosp/3047340.
I'm going ahead and closing this because I believe it's an old issue but please let me know if you're still experiencing it and I'll reopen.
ap...@google.com <ap...@google.com> #6
Branch: androidx-main
commit b0c9d6eae67f84f0a15296ebba39be48a9cd50d1
Author: Marcello Albano <maralb@google.com>
Date: Wed Apr 17 14:27:52 2024
Added tests to ensure proguard configuration is copied to extended build types
Test: ./gradlew :benchmark:benchmark-baseline-profile-gradle-plugin:test
Bug: 307784512
Change-Id: I73ba3915a2aed00baa95ad221ade5ca78c5a92df
M benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt
A benchmark/baseline-profile-gradle-plugin/src/test/test-data/app-target/
A benchmark/baseline-profile-gradle-plugin/src/test/test-data/app-target/
ga...@linecorp.com <ga...@linecorp.com> #7
I tried to verify whether this issue is fixed with baselineprofile plugin 1.2.4
But it looks this issue was not solved, yet
$ git clone https://github.com/ganadist/minimal-reproducible-example mre -b baselineprofile3
$ cd mre
$ git log -1 --oneline
3c7cda1 (HEAD -> baselineprofile3, origin/baselineprofile3) Update benchmark/baselineprofile plugin 1.2.4
$ ./gradlew :app:assembleProductionBenchmarkRelease :app:assembleProductionRelease
This version of the Baseline Profile Gradle Plugin was tested at most with the Android
Gradle Plugin version Android Gradle Plugin version 8.3.0 and it may not work as intended.
Current version is Android Gradle Plugin version 8.3.2.
### check proguard rule from app module
$ grep -C1 SuppressViolation app/proguard-rules.pro
# referenced from: void com.google.android.payments.standard.StandardPaymentsUtils.verifyCallingAppIsGoogleSigned(android.content.Context, java.lang.String, boolean))
-dontwarn com.google.apps.tiktok.testing.errorprone.SuppressViolation
### check proguard rule which was generated for productionRelease variant
$ grep -C1 SuppressViolation app/build/outputs/mapping/productionRelease/configuration.txt
# referenced from: void com.google.android.payments.standard.StandardPaymentsUtils.verifyCallingAppIsGoogleSigned(android.content.Context, java.lang.String, boolean))
-dontwarn com.google.apps.tiktok.testing.errorprone.SuppressViolation
### check proguard rule which was generated for productionBenchmarkRelease variant
$ grep -C1 SuppressViolation app/build/outputs/mapping/productionBenchmarkRelease/configuration.txt
Also, I cannot find changes which copy postprocessing
block in plugin source (createExtendedBuildTypes function) on both of androidx-main
and androidx-benchmark-release
branches.
And testcase (aosp/3047340) does not have postprocessing
block.
ma...@google.com <ma...@google.com> #8
There is no need to copy the postprocessing block manually, as it's copied when calling initWith
:
The tests ensure that this behavior works fine (and therefore we're calling initWith
).
I'm still puzzled on why you're experiencing this but thanks a lot for the repro case, that's the easiest way for me to see what's the issue!
ma...@google.com <ma...@google.com> #9
I can reproduce the issue. But it's quite odd what's going on: I suspect the bug might actually be in AGP.
Adding this task at the end of app/build.gradle
:
abstract class PrintTask extends DefaultTask {
@Input abstract Property<String> getText()
@TaskAction void exec() { println(getText().get()) }
}
androidComponents {
onVariants(selector()) { variant ->
tasks.register(variant.name + "BuildProperties", PrintTask) { t ->
def buildType = android.buildTypes[variant.buildType]
def text = "minifyEnabled=" + buildType.minifyEnabled.toString() + "\n"
text += "testCoverageEnabled=" + buildType.testCoverageEnabled.toString() + "\n"
text += "debuggable=" + buildType.debuggable.toString() + "\n"
text += "profileable=" + buildType.profileable.toString() + "\n"
text += "proguardFiles=" + buildType.proguardFiles.toString() + "\n"
text += "postProcessingProguardFiles=" + buildType.postprocessing.getProguardFiles(EXPLICIT) + "\n"
t.text.set(text)
}
}
}
I can see that the property is correctly copied:
$ ./gradlew :app:productionBenchmarkReleaseBuildProperties :app:productionReleaseBuildProperties --stacktrace
Reusing configuration cache.
> Task :app:productionReleaseBuildProperties
minifyEnabled=true
testCoverageEnabled=false
debuggable=false
profileable=false
proguardFiles=[]
postProcessingProguardFiles=[/Users/.../development/mre/app/build/intermediates/default_proguard_files/global/proguard-defaults.txt-8.3.2, /Users/.../development/mre/app/proguard-rules.pro]
> Task :app:productionBenchmarkReleaseBuildProperties
minifyEnabled=true
testCoverageEnabled=false
debuggable=false
profileable=true
proguardFiles=[]
postProcessingProguardFiles=[/Users/.../development/mre/app/build/intermediates/default_proguard_files/global/proguard-defaults.txt-8.3.2, /Users/.../development/mre/app/proguard-rules.pro]
BUILD SUCCESSFUL in 340ms
2 actionable tasks: 2 executed
Configuration cache entry reused.
Nevertheless, the content of the proguard configuration in the build folder does not have the content of custom proguard file proguard-rules.pro
.
Passing this to AGP team: to reproduce please use provided project but you can remove the baseline profile modules and the baseline profile dependency in the app module to speed up the build.
ma...@google.com <ma...@google.com> #10
I've simplified the repro project a little bit for the AGP team, removing the baseline profile gradle plugin to ensure it's not related:
To print build properties (to see the property is copied):
./gradlew :app:anotherReleaseBuildProperties :app:releaseBuildProperties
To verify proguard mapping configuration content (that will confirm the rule is not in anotherRelease
:
./gradlew :app:assembleAnotherRelease :app:assembleRelease
grep -C1 SuppressViolation app/build/outputs/mapping/release/configuration.txt
grep -C1 SuppressViolation app/build/outputs/mapping/anotherRelease/configuration.txt
cc...@google.com <cc...@google.com> #11
Over to AGP with improved repro
ja...@gmail.com <ja...@gmail.com> #12
Any update on this one?
It still affects the Baseline Profiles integration (building the benchmarkRelease) in projects where release.postprocessing is used. Both AGP 8.5.2 and 8.6.0-rc01 seem to have this issue.
je...@google.com <je...@google.com>
mi...@google.com <mi...@google.com>
ja...@gmail.com <ja...@gmail.com> #14
Looking forward to try the fix.
Will it be backported to AGP 8.6.x or 8.5.x?
an...@google.com <an...@google.com> #15
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 | 2024.2.1 Canary 9
- Android Gradle Plugin 8.7.0-alpha09
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
Continuing report from b/307473787
I tried to followhttps://developer.android.com/topic/performance/baselineprofiles/create-baselineprofile#create-new-profile
I tried to perform testcases which are generated by baseline profile generator on Android Studio.
And tests are failed, because proguard rule was not installed on
benchmarkRelease
build type.In my case, there are several
dontwarn
rules, because many 3rd party libraries references missing classes.It seems that
benchmarkRelease
build type should be inherited proguard rules fromrelease
build type.Component used: Androidx Benchmark/baselineprofile plugin 1.2.0