4

With the fantastic help of Tim on this thread Controlling Android app with bluetooth mouse/ presenter I added bluetooth remote control of my application. After finishing this, I noticed my apk file went from 175k all the way to 1711k - 10 times larger! I have implemented the bluetooth changes on a test application without seeing any change in file size so I am not sure what caused this. I did have some kind of Eclipse problem in the middle of this and had to do a rebuild to get the source to run again so maybe that had something to do with it.

Searching for file size change here and on Google gives me questions of people who want to make larger files to hold more stuff, not my question. I can't seem to find relevant answers.

The application has no graphics, pdf's, or other files of any size at all. It just reads some GPS stuff, does some math, and displays the results as text.

Is there some way to get the file size back down? Is there an Eclipse option? This is my first real (non test) application and it is finished and working but I am concerned with the file size increase.

Community
  • 1
  • 1
Allen Edwards
  • 1,488
  • 1
  • 27
  • 44
  • 3
    Did you include any external libraries? – John Mitchell Jul 24 '12 at 19:28
  • Are you comparing release build to release build? – CommonsWare Jul 24 '12 at 19:29
  • 1.7Mb really is not that big. Sure its nice to have small APK sizes but I think you may be concerned with something fairly unimportant. You could always try copying the source into a brand new project though if you think your Eclipse issue broke something. – ian.shaun.thomas Jul 24 '12 at 19:33
  • @JohnMitchell I think the only additional import that the new code included was "import android.app.Instrumentation;" but like I said, I tried adding that to a test app and the file size was 144k. CommonsWare, I just keep compiling and compiling and previous to this all the resultant files, which I email to my phone, are 175k. I have not released anything to the world if that is what you are asking. tencent, I will give that a try when I return this evening. – Allen Edwards Jul 24 '12 at 19:50

2 Answers2

6

You can check the contents of apk file easily. An apk file is simply a zip file with different extension. Just replace .apk with .zip and unzip it. Then diff the contents with your previous .apk file and find out what file makes the difference.

Caner
  • 57,267
  • 35
  • 174
  • 180
  • Hmm that is interesting, what happens if the big file is your classes.dex? – Addison Jul 24 '12 at 20:16
  • @Caner I find that there are some files called ic_launcher.png which are in a couple of my res/drawable- driectories. They are 513K in size. In the old smaller .apk file, they are very small. Can I just replace these with the older ones? – Allen Edwards Jul 24 '12 at 20:32
  • @Caner I deleted the corrupted files and the app is back to 171k. Your answer was the solution. Thank you. – Allen Edwards Jul 25 '12 at 05:47
  • @AllenEdwards how to you found "corrupted files"? I have same problem. – waki Jul 19 '14 at 14:49
0

I encountered a similar problem with the APK size. One way to check out which resources are the culprits is to 'Open Editor Log' in Console.

Some helpful explanations can be found here:

Unity build project game 2d to apk with huge size because textures

https://docs.unity3d.com/432/Documentation/Manual/ReducingFilesize.html

Community
  • 1
  • 1
Chong Lip Phang
  • 8,755
  • 5
  • 65
  • 100