Skip to content

Android/cleanup app release install #4996

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

vaslabs
Copy link
Contributor

@vaslabs vaslabs commented Apr 25, 2025

Summary

  • better organisation between androidmodule and androidappmodule (separate properly what things are used in apps and things that are shared between lib building and app building)
  • R8 and D8 dex generation depending on build type settings
  • Instrumented tests now use the android application namespace and id and adding a "variant" indicator
  • introduced a lite version of build type settings with main motivation to control r8 and d8 but also serve as a scaffolding for build variants
  • Android manifest has less hardcoded parameters (uses-sdk and instrumentation tags are now generated)
  • Minor change into testTask to keep it consistent with the rest of modules(Task.Anon) and thus the test-report is now in testForked.dest

R8 and Proguard

Followed similar configuration style with gradle

image

Although there's still work to be done in that area, if minification is enabled, we use the R8 tool to generate the dex otherwise the d8 (which also uses proguard for now) . This needs further work and clarification as AGP seems to be using R8 by default when minification is enabled, otherwise d8 is used.

Proguard default files are also fetched (as an opt-in setting) from the Android SDK directories

Build settings

I've introduced a first very minimal step for doing build variants, mainly out of necessity to manage R8 and D8 variations better, but this will be expanded once we need to fully support build variants.

The settings so far concerned the R8 use case at hand and it's a case class that has the parameters to feed proguard files and flags into R8.

R8 enhancements

Extending the work from #4892 , I've made some usability enhancements and enriched the examples to demonstrate how instrumented tests can be used alongside R8 and release builds.

I think R8 now can be fairly usable to generate minified and optimised release builds without getting in the middle of development (e.g. running tests and testing in the emulator) although more work needs to be done towards that area, but we'll follow up after we do more exploratory usability testing!

Future work

Following this work, we can move to complete the work on architecture samples by testing instrumented tests, unit tests and later on debug variants.

The cleanup also reduced a lot of duplication between AndroidAppModule and AndroidModule so it will make our development efforts a bit easier to add more features!

More discovery work will follow to align the instrumented test apk installation more in line with AGP

@vaslabs vaslabs force-pushed the android/cleanup-app-release-install branch from 4923d62 to 8bc86f5 Compare April 25, 2025 15:41
Copy link
Contributor

autofix-ci bot commented Apr 25, 2025

Hi! I'm autofix logoautofix.ci, a bot that automatically fixes trivial issues such as code formatting in pull requests.

I would like to apply some automated changes to this pull request, but it looks like I don't have the necessary permissions to do so. To get this pull request into a mergeable state, please do one of the following two things:

  1. Allow edits by maintainers for your pull request, and then re-trigger CI (for example by pushing a new commit).
  2. Manually fix the issues identified for your pull request (see the GitHub Actions output for details on what I would like to change).

@vaslabs vaslabs force-pushed the android/cleanup-app-release-install branch from adff5c0 to fe1ef0f Compare April 26, 2025 08:56
@vaslabs vaslabs force-pushed the android/cleanup-app-release-install branch from fe1ef0f to 9aeea12 Compare April 26, 2025 14:00
@vaslabs vaslabs marked this pull request as ready for review April 26, 2025 16:02
@vaslabs
Copy link
Contributor Author

vaslabs commented Apr 27, 2025

Pipeline failures don't seem related, I think they're the same as in main branch

@lihaoyi
Copy link
Member

lihaoyi commented Apr 27, 2025

Yeah looks not causes by this PR

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