Search code examples
javaandroidmoduleactionbarsherlockapk

Removing ActionBarSherlock from Modules


I'm trying to figure out why my APK is 21 MB large when I export it. I was using HoloEverywhere and ActionBarSherlock, so I'm doing an experiment to see how big my APK will be without them. To do this, I de-referenced both of the libraries. However, I notice that inside the src->.git->modules folder, there is still a folder for ActionBarSherlock that is adding around 10 MB to the whole project file. Why is it still in there if I've de-referenced both libraries and have no other connection to ABS in my project? I tried cleaning my project as well, but no luck.


Solution

  • Everything in the .git directory is for your git repo. Since git is a SCM library, it doesn't just forget about things. The .git directory will just continue getting bigger as you commit more code, even if those commits delete things. (Delete one file and it gets a tiny bit bigger since it is adding an entry to say it was deleted)

    Now as far as the .git/module directory goes, I believe that is used by git to track submodules. Removing it will probably corrupt your repo for the main project. If you decide you want to remove it, start by moving it to another directory and see if you can do checkouts of old tags/branches/commits and get a commit history. Even if that all works, I doubt you'll be able to extract an old tag/branch and do a build as you'll be missing the module that it relies on.

    If you're concerned about why your APK is so big, pull it apart to find out why. Check the second part of my answer here: Android Http client library issue

    It's a simple unzip of the APK. That will allow you to take a look at sizes of all of the non-java files and the classes.dex file. If you're wondering what the sizes of things inside the dex are, use the dex2jar. Note that because the JVM is stack based and Dalvik is register based, .class files are actually slightly smaller than the equivalent Dalvik bytecode.