Skip to content

@W-15287195: Add ProGuard consumer rules to prevent logout failures#2849

Merged
wmathurin merged 1 commit intoforcedotcom:devfrom
wmathurin:proguard
Mar 17, 2026
Merged

@W-15287195: Add ProGuard consumer rules to prevent logout failures#2849
wmathurin merged 1 commit intoforcedotcom:devfrom
wmathurin:proguard

Conversation

@wmathurin
Copy link
Contributor

Adds consumer-rules.pro files to SalesforceSDK, SmartStore, and MobileSync libraries to preserve classes instantiated via reflection. This fixes logout failures when consuming apps are built with ProGuard/R8 enabled.

The issue occurred because:

  • PushService is instantiated via reflection in PushNotificationsRegistrationChangeWorker
  • Transform and AnalyticsPublisher are instantiated via reflection in SalesforceAnalyticsManager
  • LongOperation subclasses are instantiated via reflection in SmartStore
  • SyncUpTarget and SyncDownTarget are instantiated via reflection in MobileSync

Without consumer rules, ProGuard/R8 removes or obfuscates these classes' constructors, causing reflection to fail at runtime.

Changes:

  • Created libs/SalesforceSDK/consumer-rules.pro with rules for PushService, Transform, and AnalyticsPublisher
  • Created libs/SmartStore/consumer-rules.pro with rules for LongOperation
  • Created libs/MobileSync/consumer-rules.pro with rules for SyncUpTarget and SyncDownTarget
  • Updated build.gradle.kts files to include consumerProguardFiles() configuration

Consumer rules are automatically packaged with the library and applied to consuming apps, eliminating the need for manual ProGuard configuration.

Adds consumer-rules.pro files to SalesforceSDK, SmartStore, and MobileSync
libraries to preserve classes instantiated via reflection. This fixes logout
failures when consuming apps are built with ProGuard/R8 enabled.

The issue occurred because:
- PushService is instantiated via reflection in PushNotificationsRegistrationChangeWorker
- Transform and AnalyticsPublisher are instantiated via reflection in SalesforceAnalyticsManager
- LongOperation subclasses are instantiated via reflection in SmartStore
- SyncUpTarget and SyncDownTarget are instantiated via reflection in MobileSync

Without consumer rules, ProGuard/R8 removes or obfuscates these classes'
constructors, causing reflection to fail at runtime.

Changes:
- Created libs/SalesforceSDK/consumer-rules.pro with rules for PushService, Transform, and AnalyticsPublisher
- Created libs/SmartStore/consumer-rules.pro with rules for LongOperation
- Created libs/MobileSync/consumer-rules.pro with rules for SyncUpTarget and SyncDownTarget
- Updated build.gradle.kts files to include consumerProguardFiles() configuration

Consumer rules are automatically packaged with the library and applied to
consuming apps, eliminating the need for manual ProGuard configuration.
@github-actions
Copy link

3 Warnings
⚠️ libs/SmartStore/build.gradle.kts#L16 - A newer version of net.zetetic:sqlcipher-android than 4.10.0 is available: 4.13.0
⚠️ libs/SmartStore/build.gradle.kts#L17 - A newer version of androidx.core:core-ktx than 1.16.0 is available: 1.18.0
⚠️ libs/SmartStore/build.gradle.kts#L30 - A newer version of compileSdkVersion than 35 is available: 36

Generated by 🚫 Danger

@github-actions
Copy link

25 Warnings
⚠️ libs/SalesforceSDK/build.gradle.kts#L20 - A newer version of com.squareup.okhttp3:okhttp than 4.12.0 is available: 5.3.2
⚠️ libs/SalesforceSDK/build.gradle.kts#L21 - A newer version of com.google.firebase:firebase-messaging than 25.0.0 is available: 25.0.1
⚠️ libs/SalesforceSDK/build.gradle.kts#L22 - A newer version of androidx.core:core than 1.16.0 is available: 1.18.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L23 - A newer version of androidx.browser:browser than 1.8.0 is available: 1.9.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L24 - A newer version of androidx.work:work-runtime-ktx than 2.10.3 is available: 2.11.1
⚠️ libs/SalesforceSDK/build.gradle.kts#L31 - A newer version of androidx.core:core-ktx than 1.16.0 is available: 1.18.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L32 - A newer version of androidx.activity:activity-ktx than 1.10.1 is available: 1.13.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L33 - A newer version of androidx.activity:activity-compose than 1.10.1 is available: 1.13.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L34 - A newer version of androidx.lifecycle:lifecycle-viewmodel-ktx than 2.8.7 is available: 2.10.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L35 - A newer version of androidx.lifecycle:lifecycle-viewmodel-compose than 2.8.7 is available: 2.10.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L36 - A newer version of androidx.lifecycle:lifecycle-viewmodel-savedstate than 2.8.7 is available: 2.10.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L37 - A newer version of androidx.lifecycle:lifecycle-service than 2.8.7 is available: 2.10.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L38 - A newer version of org.jetbrains.kotlinx:kotlinx-serialization-json than 1.6.3 is available: 1.10.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L39 - A newer version of androidx.window:window than 1.4.0 is available: 1.5.1
⚠️ libs/SalesforceSDK/build.gradle.kts#L40 - A newer version of androidx.window:window-core than 1.4.0 is available: 1.5.1
⚠️ libs/SalesforceSDK/build.gradle.kts#L41 - A newer version of androidx.compose.material3:material3-android than 1.3.2 is available: 1.4.0
⚠️ libs/SalesforceSDK/build.gradle.kts#L42 - A newer version of androidx.compose:compose-bom than 2025.07.00 is available: 2026.03.00
⚠️ libs/SalesforceSDK/build.gradle.kts#L43 - A newer version of androidx.compose.foundation:foundation-android than 1.8.2 is available: 1.10.5
⚠️ libs/SalesforceSDK/build.gradle.kts#L44 - A newer version of androidx.compose.runtime:runtime-livedata than 1.8.2 is available: 1.10.5
⚠️ libs/SalesforceSDK/build.gradle.kts#L45 - A newer version of androidx.compose.ui:ui-tooling-preview-android than 1.8.2 is available: 1.10.5
⚠️ libs/SalesforceSDK/build.gradle.kts#L46 - A newer version of androidx.compose.material:material than 1.8.2 is available: 1.10.5
⚠️ libs/SalesforceSDK/build.gradle.kts#L48 - A newer version of androidx.compose.ui:ui-tooling than 1.8.2 is available: 1.10.5
⚠️ libs/SalesforceSDK/build.gradle.kts#L49 - A newer version of androidx.compose.ui:ui-test-manifest than 1.8.2 is available: 1.10.5
⚠️ libs/SalesforceSDK/build.gradle.kts#L56 - A newer version of androidx.compose.ui:ui-test-junit4 than 1.8.2 is available: 1.10.5
⚠️ libs/SalesforceSDK/build.gradle.kts#L57 - A newer version of io.mockk:mockk-android than 1.14.0 is available: 1.14.9

Generated by 🚫 Danger

@github-actions
Copy link

1 Warning
⚠️ libs/MobileSync/build.gradle.kts#L16 - A newer version of androidx.core:core-ktx than 1.16.0 is available: 1.18.0

Generated by 🚫 Danger

@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.91%. Comparing base (a6fd61c) to head (46aa5d9).
⚠️ Report is 4 commits behind head on dev.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #2849      +/-   ##
============================================
+ Coverage     64.90%   64.91%   +0.01%     
- Complexity     2963     2964       +1     
============================================
  Files           222      222              
  Lines         17394    17394              
  Branches       2478     2478              
============================================
+ Hits          11289    11291       +2     
+ Misses         4906     4905       -1     
+ Partials       1199     1198       -1     
Components Coverage Δ
Analytics 47.92% <ø> (ø)
SalesforceSDK 59.74% <ø> (+0.02%) ⬆️
Hybrid 59.05% <ø> (ø)
SmartStore 78.20% <ø> (ø)
MobileSync 81.68% <ø> (ø)
React 52.36% <ø> (ø)
see 1 file with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wmathurin wmathurin merged commit f6e0be1 into forcedotcom:dev Mar 17, 2026
24 of 25 checks passed
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