Hacker Newsnew | past | comments | ask | show | jobs | submit | llamaInSouth's commentslogin

Some people still care about efficiency!


Contrary to popular belief, Java (well, Android) apps can be quite small if you have no external dependencies and minimal graphical resources. Once you depend on something like Jetpack Compose, you're pulling in about a hundred libraries and adding a few MB before minifying.


Is it even supported way to write Android apps without compat libs? I tried to do that, and struggled. I hate dependencies and prefer to avoid them, however with Android that seems almost unavoidable (or requires expert knowledge of quirks of different Android versions, I guess).


Mastodon app is built like that, the release apk is around 3 Mb, ~half of which is resources: https://github.com/mastodon/mastodon-android

Though it's not without compromises — because of Google's stupid policy that "nothing goes into the system unless it needs direct access to privileged or private system components", RecyclerView, ViewPager, and some other basic UI components are still AndroidX libraries that depend on AppCompat for no good reason. I had to fork them to rid them of that dependency: https://github.com/grishka/LiteX

Is this a supported thing to do? No. Do I care about it being unsupported? Also no.


It's not difficult to write sub-10Mb release APK for a production app with lots of features while using all the compat libraries and other useful dependencies (that do make life a lot easier). Our app is ~7Mb, and we don't even heavily optimize for APK size.

IME biggest dependencies are not compat libraries or _typical_ dependencies that Android apps need (like image loaders), but anything that involves native code. Media capabilities is one thing, but also solutions for analytics/user monitoring/SDKs for integration with Important Companies are more often than not _massive_, and companies like to track the user from many angles ¯\_(ツ)_/¯


AppCompat/JetPack don't do anything magical - they are just regular open source libraries.

If your app wants to use features which behave differently depending on the OS version, you have to if/else over the OS version. Also, note that the platform's Fragment implementation is deprecated and you might miss ViewModel.


Yes, after all, the Compat libs themselves need to talk to OS. But there's a reason why you were struggling - those libs have code that handles changes of API between different OS versions and there's been many of those during 14 major Android releases. Patching up those differences is after all the primary purpose of compat libs.


If you target latest OS - yes.


Is minifying a concern in the Java world?


Yup! It's a major step in building any Java application. Things like stripping symbol names, removing unused APIs, and processing non-java assets like images. For Android applications Gradle handles this by invoking some Android specific utilities alongside the java ones, but there's tons of build tools out there for Java that handle doing these things for everything from Blu-Rays to web apps.


Not any Java application, only on Android and embedded.

I never ever saw anyone doing it for desktop or server applications.


Unfortunately you can't treeshake a language that supports reflections. So it's not like a C++ program where unused parts get dropped.

You can manually remove dependencies or.. I think in the Android world you specify what classes can be reflected on and then strip unused code with Proguard (though I could never get it working with Clojure)

Would love to be corrected if I got any of it wrong


You surely can, it is a thing since Smalltalk and Common Lisp images.

On Java's case, all AOT toolchains and embedded deployment workflows have supported similar capabilities.


> Unfortunately you can't treeshake a language that supports reflections.

I’m pretty sure that’s exactly what the Google Closure Compiler does: https://developers.google.com/closure/compiler/docs/limitati...

Though it has a ton of restrictions on how you write code and how you can use reflection.


>Unfortunately you can't treeshake a language that supports reflections.

Like JavaScript?


Yes, you can't treeshake Javascript. You can treeshake a subset of Javascript.

If you are limiting tooling to subsets, you can also compile subsets of Python or Javascript to machine code.


I'm afraid you did get it wrong - it's very standard to do that on all Android apps. The part that you missed is that reflection is rarely used in production apps (partially because for a long time, reflection was VERY expensive on Dalvik/ART runtimes) and can be easily handled by configuration for minifier/optimizer to explicitly keep code.

Even C++ you mention does that - you have explicit __attribute__ calls to avoid linker from dropping code you want to keep for reflection purposes.


Yup! Most used to rely on Proguard but nowadays, Android ships an alternative called R8: https://developer.android.com/build/shrink-code


Yes, it's enabled by default even in tutorial Android apps - Proguard was the tool used in olden days and has now been replaced by Google developed R8 optimizer/minifier.


zooming in or out with the touch-pad is a nightmare (way to slow)


I'm using a mouse without a scroll wheel, and can't zoom at all. + and - on the keyboard would have been useful.


Android 14's camera shows you the URL and doesn't load it right away...




> Terminating those relationships after a single violation would simple result in the eradication of all SMS sending services, except physical mobiles phones.

Might not be a bad thing... it would stop a lot of spam and stop companies from using SMS for 2FA


Can you re-charge those like you fill up a gas tank?


Yes, although you'd also have to drain the tank of spent fuel. Could be done with a double-nozzle filler.


Or qadruple nozzle, as you need to do both for the anode and the cathode fluid.


Sounds like a much worse solution than what we currently have which is pretty simple and cheap


I don't agree. It's way way better than charging an electric battery. For those who can't charge at home this is a real pain in the ass right now and a big time waster (which driving already is compared to public transport where you can at least do something with that time, like read, study, watch something)


Charging at home is a time waster? You just plug it in right? Idk where the waste is there.

In the US driving isn't really a time waster compared to public trans because pub trans is usually slow, doesn't take you to your destination so you gotta walk, doesn't come frequently and you put yourself in more physical danger. Hard to read when there is a guy tweaking next to you.

The costs of doing this plan mean that it will absolutely never happen. The grid is there, super chargers are easy to use, no fluid storage or machines to manage fluids. No fluid leaks, no extra infra.

Plus battery tech and ability to recharge is always changing.


No, I mean it wastes time if you can't charge at home because you have to regularly wait while it charges elsewhere.

You can sometimes combine it with a shopping spree or something but if you don't happen to need to do that (which for me is most of the time) you're stuck waiting.

I mean when I still had a car I used to hate going out just for a tank run (like before a night trip to the airport) and the station was within half a mile. I couldn't do that every few days plus have to wait around for that thing to charge. My car was to make my life easier, not harder (and even then it failed at that because I hate driving so much). Glad I live in a city now with amazing public transport.


The big advantage of a flow battery is that "recharging" can be just about as fast as filling up a gasoline-powered car.

The energy is in liquid form... you just drain the used liquid, fill it up with "charged" liquid, and you're back on the road.

The "dead" liquid is "recharged", but that happens in tanks at the fueling station. The car doesn't have to sit there and wait.


Well made electric vehicles are A) getting faster to charge B) already have the infrastructure in place C) Way cheaper to install. No fluids to exchange, no facility to create/store/handle fluids.

Standard Model 3 has 272 miles of range. That 4.5 hours of driving, which is way more than most people are doing in a day. I drive 30k miles (~3x the average) a year but average about 80 miles a day.

Unless you are driving across the country frequently this isn't really going to make any sense. Then on top of that you are going to have to support totally different battery tech, then also the density of these batteries isn't great.

This is just never gonna happen.


Based upon their example "just about as fast as filling up a gasoline-powered car." Is not exactly accurate for a number of reasons.

On paper, it would be more like filling up and emptying 4 gasoline-powered cars. That's about 8x the process in the ideal case.

Other considerations would be the necessity for 8x as much storage in gas stations, 8x as many refilling trucks to supply and empty those stations, and above all, the development of a nationwide network of such infrastructure as pervasive as the existing fuel network.

This is even more dead on arrival than hydrogen.


Why would it need 8x the storage or trucks? They'd recharge the spent fluid on-site and re-use it.


You do understand that conventional gas pumps are legacy devices on which the UI dates back to the days when the gas was literally pumped by hand?

That they don't remotely approach maximum practical flow rate that can be produced by a pump, even a small one?

That there are quick connectors that can vastly exceed the flow rate of the current hand-held nozzle shoved into a hole?


Are you talking about filling a gas tank, or charging an EV battery? Why do you think it sounds like a worse solution?


Charging an EV battery. Lots of easy to use infra in place. No exchange of fluids.


But it would be a lot faster... and I don't have much issues with the fluid in my gas car


That doesn't matter. The infrastructure cost makes it completely infeasible for the rare few times you'd have to fill up on the road and the small amount of time it would cost you.


This video helped me visualize how big of a number 1 trillion is:

https://www.youtube.com/watch?v=PoOJggESR8o

Current US debt is almost 34 trillions? https://www.usdebtclock.org/


So the debt is just a bit more than two of these microSD cards' worth of storage! I might have the unit conversion wrong, though.


> If only it was so easy as running a trace on the criminal and then driving down to their location to arrest them, just like the movies.

There's Youtubers that find call centers, hack into their network, watch them on their camera systems and mess with them[0]... surely the authorities could do more

0. https://www.youtube.com/results?search_query=hacked+call+cen...


If you want to throw out due process sure. "The authorities" can't just hack networks. While entertaining, what these YouTubers are doing is very illegal.


It's probably also all staged


You’re not buying into this, are you?



That’s the one


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: