At least in part, I expect this is because of the AppCompat library that Google recommends using. If you pull in the whole thing, as tutorials show, it adds a huge number of images (icons and such) that don't get trimmed during compilation (which they're supposed to, if unused) - these make up something like 95% of the size of an app I'd recently been working on. I'd only noticed it because this was a rework of one I'd made ~10 years ago, before AppCompat existed.
I can't help but wonder if some of the "optimizations" done by Google when you turn over your keys and let them compile the apk is just removing this extra bloat.
A new out-of-box “Empty Activity” app project in Android Studio compiles to a 1.59 KB APK (if implemented in Java; it goes up to 2.26 MB APK with Kotlin). Rip out the dependencies on AndroidX, and the APK size plummets to 103 KB. (The APK for the de-Appcompat'd Kotlin version is, correspondingly, 709 KB.) 1.5 MB overhead – fifteenfold – for a more convenient layout[0] and the Material theme. Mind-numbingly wasteful. In a big enough app, that overhead will be overshadowed by the size of the meaningful bits, but how many apps really get that big? How many games include Appcompat and then draw their own UI anyway?
At least in part, I expect this is because of the AppCompat library that Google recommends using. If you pull in the whole thing, as tutorials show, it adds a huge number of images (icons and such) that don't get trimmed during compilation (which they're supposed to, if unused) - these make up something like 95% of the size of an app I'd recently been working on. I'd only noticed it because this was a rework of one I'd made ~10 years ago, before AppCompat existed.
I can't help but wonder if some of the "optimizations" done by Google when you turn over your keys and let them compile the apk is just removing this extra bloat.