0

I developed a titanium mobile application using appcelerator and its working fine. The problem is with the size of the apk and the IPA file. The application contains hardly 100 lines of code but the apk size is 6MB and IPA size is 4.5MB. When I Google about it I saw some suggestions of optimizing the code so I tried with that also now my code contains nearly 70 lines but still the size remains the same in both apk and IPA. And then I just ran a simple hello world application to do cross check then it was shocking that small hello world application also generated 5.4MB apk. How could this possible.

What is happening here with respect to size?

Niv
  • 59
  • 1
  • 4

2 Answers2

7

What you are seeing here, is a result of using Titanium. Titanium comes with a lot of extra code to make it work, including a JavaScript parser and more.

Once you build for deployment it will become smaller, but still be around 3-4 MB's (in my experience).

The plus side is, in your case, if you have 1000 lines of code, the size of the application will still be around the same size as this code is relatively nothing.

I noticed myself you can get the APK smaller, by unzipping it, and re-zipping it yourself. Apparently Titanium doesn't zip properly. As you might now, a .apk is in fact a .zip. So change extension, unpack, and repack yourself. That should make the APK smaller.

Rene Pot
  • 24,681
  • 7
  • 68
  • 92
0

First of all, sorry I cannot comment at your post because my reputation level is still low. However a valuable tip to reduce the APK total size (only the APK) is to restrict the build's architecture of Android.

The Titanium SDK still building for all archs available, included armv5/armv6 that was very old devices, a short list can be checked at here. The trick is to restrict your build adding the <abi> at your tiapp.xml like this:

<android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest></manifest>
        <abi>armeabi-v7a</abi>
</android>

Edited

Keep attention, if you are using Genymotion emulator remember to remove the restriction before build, that was the emulator isn't armeabi-v7a

Victor Casé
  • 745
  • 8
  • 15