Just a quick question, When I add a library to my project does all the library code get added to my final app / apk or is it just the functions that are used. My app uses quite a few libraries and the final APK is larger that I thought it would be >1.3mb. Just wondering if its due to library use or not.
My app references AHActionBar, AHQuickActions, AHPreferences, Core, Dialogs, HTTP, ICSPopup, id, JSON, MimeType, OAuth, Phone, RandomAccessFile, Reflection, RichString, StringUtils, TabHostExtra even though I dont use all of them.
My apk size obfuscated is 635 KB.
I have found that the assets in the file folder of the project most times is the largest portion of the apk file. This is the case at least for me. And I do believe that the complete library will be included. Erel would be the one to confirm if this is the case.
It's too bad that B4A does it that way. It defeats the whole purpose of a library. When you walk into a library, you check out one or two books and take them home. You don't walk out with every book in the building. B4A should, at compile time, take what it needs and leave the rest behind.
Not at all. Without libraries the "core" library would have included all the APIs. By using libraries you can select only the libraries you need. The same thing happens in Java when you reference a Jar file and in C# when you reference a DLL and in other programming languages.
The compiler cannot really know which classes inside the libraries are required.
In most cases the size of a single bitmap will be more than the size of all the libraries you add.
It's too bad that B4A does it that way. It defeats the whole purpose of a library. When you walk into a library, you check out one or two books and take them home. You don't walk out with every book in the building. B4A should, at compile time, take what it needs and leave the rest behind.
It kind of does work like that. B4A picks the libraries you checked out in the libraries tab, it doesnt include all of them.
However, from the check out libraries, whether you use the code or not, the code does get included. Like the one or two books you do take home, whether you read all the pages or not, you have to take the whole book.