Skip to content
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

Release APK Minification and Shrinking #3513

Open
qiarie opened this issue Sep 19, 2024 · 1 comment · May be fixed by #3520
Open

Release APK Minification and Shrinking #3513

qiarie opened this issue Sep 19, 2024 · 1 comment · May be fixed by #3520
Assignees

Comments

@qiarie
Copy link
Contributor

qiarie commented Sep 19, 2024

Describe the feature request.
OpensSRP 2 release APKs are currently not optimized for size, resulting in larger APKs that may have an effect on app performance. Minification and shrinking can help reduce APK size by removing unused code, resources and libraries. It also helps improve app performance and ensures only necessary components are packaged.

Additional context
Benefits from enabling minification and shrinking:

  • Reduced APK size
  • Improved app performance
  • Obfuscation increases app security
  • Meet Play Store requirements of 150 MB size limit

Acceptance criteria

  • Minification and shrinking are enabled for release builds
  • APK size is significantly reduced compared to current non-shrunk builds
  • No crashes or unexpected behaviour with the minified APK
  • APK functions correctly across multiple devices and Android versions
  • Obfuscation does not interfere with the readability or functionality of critical logs for debugging purposes

Implementation plan (For Engineers)

  • Enable Minification and Shrinking

    • In build.gradle under buildTypes > release:
    getByName("release") {
        isMinifyEnabled = true
        isShrinkResources = true
        proguardFiles(
            getDefaultProguardFile("proguard-android-optimize.txt"),
            "proguard-rules.pro",
        )
      ...
    }
    
    • Configure Sentry
      • Add Sentry configs for reporting minified and obfuscated code
    • Configure ProGuard/R8
      • Update ProGuard rules to prevent important classes and libraries from being stripped or obfuscated
      • Ensure logging, exception handing and other external libraries are retained
    • Testing
      • Build and test on different devices with different Android versions to confirm that there are no crashes, missing resources and performance degradation
      • Confirm reduction of the APK size with shrinking and minification enabled
      • Test UI and other functions to ensure alal features work correctly
    • Logging & Debugging
      • Ensure that mapping files are generated and saved during the build process for debugging when obfuscation enabled
      • Verify that important log entries are still readable and useful for debugging
    • Documentation
      • Document known issues, workarounds related to ProGuard rules added

References

@qiarie qiarie self-assigned this Sep 19, 2024
@qiarie qiarie linked a pull request Sep 24, 2024 that will close this issue
11 tasks
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 a pull request may close this issue.

3 participants
@qiarie @ndegwamartin and others