Skip to content

Restore legacy shrinking configuration for AGP 8.4.x #2867

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

Merged
merged 2 commits into from
May 17, 2024

Conversation

jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented May 17, 2024

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Disable the new way of shrinking code added in AGP 8.4.0.

Motivation and context

It's causing issues with release builds and no changes in proguard rules seem to fix them.

i.e.

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/jorge/Developer/Element/element-x-android/app/build/outputs/mapping/gplayRelease/missing_rules.txt.
ERROR: R8: Missing class io.element.android.libraries.designsystem.atomic.atoms.ElementLogoAtomSize (referenced from: void io.element.android.features.ftue.impl.welcome.WelcomeViewKt$WelcomeView$2.invoke(androidx.compose.runtime.Composer, int) and 1 other context)

That missing_rules.txt files just contains -dontwarn entries that do remove the errors while building, but then the classes aren't present in the resulting APK and the app instantly crashes on boot.

Adding --keep class io.element.android.foo.SomeMissingClass { *; } does nothing either.

Tests

We should be able to build nightlies again with this change.

This nightly build flow based on this branch built the apk just fine: https://github.com/element-hq/element-x-android/actions/runs/9124298023/job/25089536772

Checklist

The current one is causing issues with release builds and no changes in proguard rules seem to fix them.
Copy link
Contributor

github-actions bot commented May 17, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/T3yxGU

Copy link

codecov bot commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.06%. Comparing base (9d4cfd8) to head (e01b9ad).
Report is 3 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2867   +/-   ##
========================================
  Coverage    74.06%   74.06%           
========================================
  Files         1530     1530           
  Lines        36542    36542           
  Branches      7055     7055           
========================================
  Hits         27064    27064           
  Misses        5791     5791           
  Partials      3687     3687           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jmartinesp jmartinesp marked this pull request as ready for review May 17, 2024 08:24
@jmartinesp jmartinesp requested a review from a team as a code owner May 17, 2024 08:24
@jmartinesp jmartinesp requested review from bmarty and removed request for a team May 17, 2024 08:24
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@@ -59,3 +59,6 @@ android.enableBuildConfigAsBytecode=true

# By default, the plugin applies itself to all subprojects, but we don't want that as it would cause issues with builds using local AARs
dependency.analysis.autoapply=false

# Disabled new R8 shrinking for local dependencies as it causes issues with release builds
android.disableMinifyLocalDependenciesForLibraries=false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird that the value is false, it would be more logical to have true, but https://developer.android.com/build/releases/gradle-plugin#library-classes-shrunk is not clear about it.

If it fixes the issue, that's fine!

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@jmartinesp jmartinesp merged commit f03818f into develop May 17, 2024
16 checks passed
@jmartinesp jmartinesp deleted the misc/jme/agp-8.4-restore-legacy-shrinking-config branch May 17, 2024 09:08
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