Skip to content

build: DEX code optimization - #5032

Merged
jesmrec merged 11 commits into
masterfrom
technical/dex_code_optimisation
Nov 4, 2026
Merged

jesmrec merged 11 commits into
masterfrom
technical/dex_code_optimisation

Conversation

@jesmrec

@jesmrec jesmrec commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Related Issues

App:

  • Add changelog files for the fixed issues in folder changelog/unreleased. More info here
  • Add feature to Release Notes in ReleaseNotesViewModel.kt creating a new ReleaseNote() with String resources (if required)

QA

Test plan: https://github.com/owncloud/QA/blob/android/sharing_ng/Mobile/Android/Executions/Release_4.9/DEX%20code%20optimization.md

Extra checks: #5032 (comment)

@jesmrec jesmrec linked an issue Oct 22, 2026 that may be closed by this pull request
@jesmrec
jesmrec force-pushed the technical/dex_code_optimisation branch 3 times, most recently from ea37b6c to 1bb4116 Compare October 22, 2026 12:24
@jesmrec
jesmrec marked this pull request as ready for review October 22, 2026 12:33
@jesmrec
jesmrec requested a review from a team as a code owner October 22, 2026 12:33
@joragua joragua changed the title fix: DEX code optimization build: DEX code optimization Oct 23, 2026
@joragua

joragua commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Regarding proguard.cfg, should it also be removed when adding the new file? It doesn't appear to be used anywhere in the project, unless I'm missing something @jesmrec

@jesmrec

jesmrec commented Oct 26, 2026 •

Copy link
Copy Markdown
Member Author

Regarding proguard.cfg, should it also be removed when adding the new file? It doesn't appear to be used anywhere in the project, unless I'm missing something @jesmrec

you're right, it's not referenced apart of very old and not maintained. The current file should be enough. Removing it.

@jesmrec

jesmrec commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

Extra updates:

  • AppRegistryProvider class does not have @JsonClass annotation. It is serialized to JSON by KotlinJsonAdapterFactory and stored as a plain string in the app_providers Room column. Without this rule, R8 renames its fields, making stored JSON unstable across releases and causing app providers to silently disappear after an app update.

  • Replace all rules about classes extending androidx.preference.PreferenceFragmentCompat for a wildcard, so that, any newly created class extending will be also covered by the rule.

  • The four custom view keep rules in proguard-rules.pro were deleted because the Android build tools (AAPT) already generate exactly those rules automatically by scanning the layout XML files. Removed to avoid that duplication

  • The Moshi rule was changed from -keep @JsonClass class * { *; } to -keepnames @JsonClass class *. The old rule prevented R8 from removing any member of every Moshi model class, blocking the shrinking that was the whole point of enabling R8; the new rule only prevents renaming, which is all that's actually needed to keep JSON field mapping working.

@jesmrec

jesmrec commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

New update:

  • Classes inside of com.owncloud.android.lib.common.http.logging were data classes with no @JsonClass, so the existing -keepnames @JsonClass rule doesn't cover them.

joragua
joragua previously approved these changes Oct 29, 2026

@joragua joragua left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Let's move it to QA 🚀

@jesmrec
jesmrec force-pushed the technical/dex_code_optimisation branch from bbaa3a9 to a0847a5 Compare November 4, 2026 08:17
Signed-off-by: Jesus Recio <jrecio@izertis.com>
Signed-off-by: Jesus Recio <jrecio@izertis.com>
Signed-off-by: Jesus Recio <jrecio@izertis.com>
Signed-off-by: Jesus Recio <jrecio@izertis.com>
Signed-off-by: Jesus Recio <jrecio@izertis.com>
Signed-off-by: Jesus Recio <jrecio@izertis.com>
Signed-off-by: Jesus Recio <jrecio@izertis.com>
Signed-off-by: Jesus Recio <jrecio@izertis.com>
…members

Signed-off-by: Jesus Recio <jrecio@izertis.com>
Signed-off-by: Jesus Recio <jrecio@izertis.com>
@jesmrec
jesmrec force-pushed the technical/dex_code_optimisation branch from a0847a5 to c98433e Compare November 4, 2026 11:31
@jesmrec

jesmrec commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

After performing tests

  • Authentication: all available methods: basic, OAuth2, OIDC, that include responses handled by Moshi
  • Browsing and file handling
  • Passcode/Biometrical: uses reflection-heavy AndroidX security APIs
  • Auto upload: triggers WorkManager workers, the most likely source of ClassNotFoundException
  • Av. offline: triggers WorkManager workers, the most likely source of ClassNotFoundException
  • Transfers (upload/downloads): also affected by WorkManager
  • Spaces: include many responses handled by Moshi
  • Open in web: AppRegistryProvider must be deserialized by Moshi.

Executed E2E tests over...

Signed-off-by: Jesus Recio <jrecio@izertis.com>
@jesmrec
jesmrec merged commit c7237ed into master Nov 4, 2026
12 of 13 checks passed
@jesmrec
jesmrec deleted the technical/dex_code_optimisation branch November 4, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TECHNICAL] DEX code optimisation is below Google threshold

2 participants