1

I have an app project on Android which is almost 100Mb in size. The same project for iOS is only 2.3Mb in size. As you can see this is a HUGE size difference. So I would like to know what is causing an android project to be so large? There was a time when it was smaller and all of a sudden I started realizing that it takes longer to upload the files to my backup server and when I looked at the size I noticed why.

It is not a very complex app, only has about 12 Activities. I checked the size of the drawable folders and they are not even 1Mb. So what is so large? Is there anything in the project that gets left when the APK is created or will this be the size roughly when I want to publish the app?

Hoping someone could shed some light so I can learn, I am more of a swift developer than android, so this is really weird to me. Also, it seems with every update that Android Studio does, my app size increases. How is this possible?

Christopher Smit
  • 953
  • 11
  • 27
  • 1
    "I have an app project on Android which is almost 100Mb in size" -- what *exactly* are you measuring? – CommonsWare Jul 02 '17 at 18:24
  • I am looking at the folder size containing my app. Should I not be looking at this? Sorry I normally look at the entire folder as this is the "project" I am uploading to my backup server – Christopher Smit Jul 02 '17 at 18:26
  • 1
    Don't backup (and measure) the /build and //build folders. These contain intermediary and generated files by the build process. – Eugen Pechanec Jul 02 '17 at 18:26
  • how bigs the APK – IAmGroot Jul 02 '17 at 18:28
  • "I am looking at the folder size containing my app. Should I not be looking at this?" -- no, that's fine. However, questions of the form "why is X so big?" implies that everybody knows exactly what X is. For all I knew, you were referring to the compiled APK size. "So what is so large?" -- mostly your `build/` directories, off of the project root and off of each module root. Those do not get checked into version control, as they represent build output, as Eugen notes. If backing them up is painful, exclude them from the backups. – CommonsWare Jul 02 '17 at 18:33
  • @Eugen, okay that makes sense. The build folders combined are almost 70Mb in size. So if I do not have to measure these then I feel a little better. So effectively I can safely backup my project without these folder? However, without these, the app is still about 30Mb in size compared to the iOS app. Does the size get compressed once you generate the APK? – Christopher Smit Jul 02 '17 at 18:33
  • @CommonsWare, apologies I speak of my project as the entire containing folder. Anyway thank you, it makes more sense now. – Christopher Smit Jul 02 '17 at 18:36
  • @Doomsknight , I have not generated the APK yet as I am still in development with the app. – Christopher Smit Jul 02 '17 at 18:37
  • Look at a typical .gitignore file for Android Studio here: https://stackoverflow.com/questions/16736856/what-should-be-in-my-gitignore-for-an-android-studio-project. Any files matching rules in this file should not be put to VCS and therefore regular backup. Note that you'll still need a valid local.properties file if you decide to restore your backup and build the project. Also note that local.properties and IDEA metadata will be generated for you if you open the backup project in Android Studio. (local.properties contains path to your Android SDK.) – Eugen Pechanec Jul 02 '17 at 18:49
  • Thank you for the detailed explanation. I appreciate the help. Makes much more sense now. – Christopher Smit Jul 02 '17 at 19:04

0 Answers0