[Cleanup] Removed Android 4.2 proguard workaround
Purpose / Description
This workaround was initially implemented for app crashing on Samsung devices on Android 4.2. We are currently only supporting API 21+ (Android 5.0) so there is no need for this workaround now & this can be removed.
Checklist
- [x] You have a descriptive commit message with a short title (first line, max 50 chars).
- [x] You have commented on your code, particularly in hard-to-understand areas
- [x] You have performed a self-review of your own code
- [ ] UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
- [ ] UI Changes: You have tested your change using the Google Accessibility Scanner
I'll test it with proguard enabled on a few devices & report back. Will also try to report back the differences in size in a few days. If not we can set minifyEnabled as false.
If not we can set minifyEnabled as false.
This will likely also have an effect, as it may not strip out unused library code, so it would also need a size comparison
This stuff is really subtle!
I suggest also checking if switching on R8's full mode will cause any issues. That got me a 13% reduction in APK size for free! (After I got Google to fix a bug in R8.)
Touching anything related to R8 can cause super weird crashes. You basically want to test all API versions on as many devices as possible, and you want to test as much of what the app can do as possible, especially anything related to crypto and serialization. Also a few times I got reports of crashes that I also couldn't reproduce, that was fun dealing with.
Also, enabling “minification” will IIRC enable obfuscation, which can significantly reduce APK size but also it makes tracebacks unreadable. R8 produces mappings that can be used to decode the tracebacks, and Google Play Console can also understand them. Still, not enabling obfuscation makes life a little bit easier eh.
Hello 👋, this PR has been opened for more than 2 months with no activity on it. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically
This is still useful, it just requires really careful testing. I'd prefer to have the bugfix release cycle for 2.16 done first and tackle this early in the 2.17 cycle if possible
I'm a bit busy at the moment, will get back to fixing this as soon as I get some time free.
I'll start working on this issue again as I am done with my exams now.
So the first rule tells Proguard to keep all class attributes. The second rule tells Proguard to keep all classes that do not match a set of specified patterns, except for certain classes that are listed explicitly. The third and fourth rules tell Proguard to keep certain specific classes. The remaining rules tell Proguard to disable specific optimizations and not generate a warning or note messages for specific patterns.
ActionBarOverflow has just been removed, so the rules related to it can go.
Updates:
(Just started work on this again)
These lines do not seem to do anything:
-keep class !android.support.v7.view.menu.**,!android.support.design.internal.NavigationMenu,!android.support.design.internal.NavigationMenuPresenter,!android.support.design.internal.NavigationSubMenu,** {*;}
-keep public class android.support.v7.internal.view.menu.** { *; }
Because android.support packages are deprecated in favour of androidx. Source: https://developer.android.com/topic/libraries/support-library/packages
-keepattributes **
This option preserves all non-class attributes of classes and class members in the processed output. This means that all attributes except for those explicitly excluded by other directives will
-dontpreverify
-dontoptimize
-dontshrink
These lines completely disable Proguard and do not perform any optimization. These directives instruct Proguard to skip obfuscation, optimization, and preverification steps, effectively disabling Proguard.
-dontwarn **
-dontnote **
The "-dontwarn **" and "-dontnote **" directives in a Proguard configuration file instruct Proguard to suppress all warning and note messages that would otherwise be generated during the processing of the input. The "-dontwarn" directive tells Proguard not to issue warnings for any classes or members that it encounters during processing, while the "-dontnote" directive tells Proguard not to issue any informational notes.
So wasn't proguard disabled using this configuration?
Will do some size tests & report back here :)
I believe it is mostly disabled, however I seem to remember that the debug APK vs the release APK was quite a different size indicating there is still part of the system enabled and "helping" (from perspective of reducing APK size delivered to device).
Ideally we would enable as much of it as we can, but without causing crashes - again to reduce size of transfer and install size on device
In the release apk it seems like R8 mode mentioned by @oakkitten is enabled for some reason.
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically
Commenting to keep this open.
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically