4 ms·
1.5 MB for an app that does nothing. 1.5 million bytes for nothing. How inefficient we are these days. I really wish it were as simple as this: $ cat > mya
by dheera 9y ago
1.5 MB for an app that does nothing. 1.5 million bytes for nothing. How inefficient we are these days. I really wish it were as simple as this:
$ cat > myapp.aml
<!doctype android>
<head><title>My App</title></head>
<app activity="MainActivity.java"></app>
^D
$ cat > MainActivity.java
import android;
class MainActivity extends Activity {
void main() {
android.toast("hello world");
}
}
^D
$ android compile myapp.aml
Could not find a keystore in your home directory. Would you like me to create one for you (y/n): y
Enter a keystore password: ********
Confirm password: ********
Thanks!
Compiling Java code ... done!
Zipping it up ... done!
Signing ... done!
Byte-aligning ... done!
Wrote myapp.apk. You're ready to upload to the Play Store!
$
But no. We must over-complicate things. AppCompatActivity, manifestations of manifests, layers upon layers of gradle BS, keystores, lots of stackoverflow lookups just to deal with byte aligning, signing, etc. And then Android Studio updates itself, breaking your entire project's 79+ files that for a blank app. What has the world come to?
- maxsilver 9y agoI totally agree with you. But as an Android developer, I know why we won't get to this... What does this app do on phones? On tablets? On laptops? Where is the header bar (the original has one, yours doesn't). What color is it? What font? What placement? What about users who don't read English? What about users who's languages don't fit in ASCII. What about users who's languages aren't read left-to-right. How should the header bar even be drawn? What about devices that can't draw the header bar as defined? What about devices that were invented before header bars even existed? What about devices whos OEMs fundamentally redefined what 'drawing' even means. MainActivity.java does what? Is it Java 6? 7? 8?. Which of the 26 'Activity' classes are you extending from, and how do you know it exists on the device? How do you know it behaves identically? The .toast method does what? For which phones? On which API release? How long or short should the Toast display for? Your keysigning the app? Which method of keysigning are you using (old or new, they aren't the same). Who's authoritative for the signing (yourself, or Google Play. Those aren't the same either.) The sample app, with it's 1.5 million wasted bytes that 'do nothing' handles those problems. It's easy to say "I saved 5k bytes by dropping RTL" but... you dropped all RTL language support. People use that stuff. The example steals a pre-made asset from system resources to save space, which is clever until system resources you need aren't there, which happens in the real world. AppCompat is heavy, but it isn't bytes-for-nothing. Some poor souls at Google waste a lot of time making sure developers get a large library of useful layouts and controls that all mostly-just-work mostly-consistently across a huge spectrum of devices and API releases. No one intentionally sits down and builds over-complicated code by choice (except perhaps Spring). Every layer of the BS here may be annoying and wasteful, but it attempts to solve a real problem a real person had to deal with. I love the simplicity of your example. But I'm not sure I'd want to deal with the consequences of living in that world.
- userbinator 9y agoThe sample app, with it's 1.5 million wasted bytes that 'do nothing' handles those problems. If all apps have to include 1.5MB of code to handle the same set of problems, then it sounds like the perfect place for that code is in a shared library, perhaps distributed with the OS.
- pipeep 9y agoA large amount of that 1.5 MB of code is to shim around the incompatibilities between different versions of the shared libraries that ship with Android. The root of the problem is that not everyone is on the same version of Android.
- userbinator 9y agoThe root of the problem is that not everyone is on the same version of Android. Alternatively, it seems the root of the problem is that all the different versions of Android don't have enough commonality for compatibility. I have apps which were originally written for Win95 and continue to work on Win10. Microsoft hasn't always made great decisions, particularly recently, but seeing a single small binary run unchanged over 20+ years of platform differences is something that IMHO other companies can learn much from. (I know Android devices, despite mostly being ARM, cover a wider range of architectures... but isn't that what basing everything on Java was supposed to solve?)
- dlubarov 9y agoI don't really see a difference. Android's API changes are almost always backwards compatible. There are a few exceptions, like AudioManager.setRouting (now a no-op), but they're very rare. For the most part, apps built for for early versions of Android still work fine on modern devices. The support libraries which the parent referred to are optional utilities. They're often the most convenient way to implement something like a snackbar (https://material.io/guidelines/components/snackbars-toasts.html https://material.io/guidelines/components/snackbars-toasts.h...), but they're by no means required. Just like on the Windows side, WPF is probably the most convenient way to create a ribbon, but you could build your own with the old win32 APIs if you wanted to, or just not use ribbons.
- userbinator 9y agoFor some amazing contrast, here's a 4 kilobyte(!) binary which renders a 215-second-long realtime 3D scene, complete with music: https://news.ycombinator.com/item?id=11848097 https://news.ycombinator.com/item?id=11848097 You may rebuke it with "but it's 4KB on top of hundreds of MB or GB of OS and drivers", but so is this 1.5MB do-nothing app.
- aaron695 9y agoDoesn't work on my windows 10 machine.
- deleted 9y ago[deleted]