Android/cleanup app release install #4996
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
testForked.destR8 and Proguard
Followed similar configuration style with gradle
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
AndroidAppModuleandAndroidModuleso 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