8

I imported a ADT project to the latest version of Android Studio (0.6.1). Both projects share the same code and libraries. Also both projects were cleared and compiled with the same ProGuard settings enabled.

But the size of the ADT APK file is 1.8 MB and the Android Studio APK file is 2.7 MB.

Is this increase of 50% in APK file size considered as normal due to the fact that Android Studio is still in Early Access Preview or should I be able to get nearly the same APK file size?

(Update: I just unzipped the APK file: All files are nearly the same size, but the difference comes from the classes.dex file which is 1.2 MB on ADT and 4.4 MB on Android Studio.)

Steffen
  • 2,197
  • 2
  • 24
  • 38
  • 1
    Have you tried unzipping the apk and see what the differences are? – hoomi Jun 23 '14 at 13:26
  • Have you tried unzipping the apk and see what the differences are? – hoomi Jun 23 '14 at 13:28
  • The difference from the file size comes from the classes.dex file which is 1.2 MB on ADT and 4.4 MB on Android Studio. Hm, that's a huge difference. I think this can't be considered as normal? – Steffen Jun 23 '14 at 13:35
  • interesting!! I never noticed this before. Can it be gradle specific thing? Maybe it has more overhead? – hoomi Jun 23 '14 at 13:37
  • 1
    reverse engineering tools will unpack the classes.dex and allow you to compare what is in there – Chris Stratton Jun 23 '14 at 13:55
  • Thank you for leading me into the right direction. The reverse engineered (Android Studio) code wasn't obfuscated. I had to change the build variant of the app module first. – Steffen Jun 23 '14 at 14:32

1 Answers1

6

By reverse engineering the classes.dex files I found out that my code wasn't obfuscated in Android Studio.

Even though it seemed to me that ProGuard was enabled via runProguard true in my build.gradle and the checkbox asking for ProGuard before generating the signed APK file.

I had to change the build variant of the app module from debug to release as described here.

Now both APK files are almost the same size (1.812 vs. 1.817 MB).

Community
  • 1
  • 1
Steffen
  • 2,197
  • 2
  • 24
  • 38