Android Question #ExcludeClasses, alternative?

designer2k2

Member
Licensed User
Longtime User
Hello,

is there a way i can prevent certain classes to be included in the final app? I want to slim down my app.

Background, my app used to be 800KB and i "bragged" that its below 1MB, back then i used #ExcludeClasses a lot.
I decompiled the dex to see whats inside and then excluded everything i did not need back then.

Now ExcludeClasses does not exist anymore and i added some features and with some new libs i am up to 1900KB. That´s a lot for what the app is doing...

So i would like to remove unused code, ideally without having to manually do that.

What can i do to slim down the app?
 

William Lancee

Well-Known Member
Licensed User
Longtime User
If you're not familiar with the source code files, I recommend looking at them.
Here is a snippet of one of my xxx.b4j files looking with Notepad++

For a large project you could use this to remove un-needed modules.


1699152749664.png
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Background, my app used to be 800KB and i "bragged" that its below 1MB, back then i used #ExcludeClasses a lot.
I decompiled the dex to see whats inside and then excluded everything i did not need back then.

Now ExcludeClasses does not exist anymore and i added some features and with some new libs i am up to 1900KB.
As I see it, it isn't worth your time or our time to trim 1MB from the app size. 1.9MB is about 15% of the size of a single image taken with the phone camera.
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
I guess some of us can't get used to the LARGE amount of computer memory available to us.
A punched card could store only 80 bytes, and if your program was 92 bytes, you had to use 2 cards or trim your code by 15%. :)
 
Upvote 0

designer2k2

Member
Licensed User
Longtime User
Thanks for the advice to look into the source code, i have taken a look at the source code from the libs.
I have now some modified libs, that only contain what i actually use.
That and some work on the assets let the app went down to 1.2MB :)

Its clear that the app is already compact, but at least i have to try.

And then there is something like this, where they pushed a 1.5MB app down to 678 bytes, yes, bytes! https://github.com/fractalwrench/ApkGolf

So there is no alternative to #ExcludeClasses besides manually editing libs?
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
As Erel says, unless it gives you some sort of sadistic pleasure, there is absolutely no point nowadays in scrabbling to save a few bytes of memory.

When I started out our computers had only 4096 words of 24 bit memory and as microprocessors came in we were working with only 1024 bytes of RAM. Now there is no need to worry about memory usage at all.
 
Upvote 0
Top