3
votes

I have a small app that only haves a size of 65kb when apk is installed. Now i need to use admob on the app, and after adding google play services lib, now my app haves 8.8 megabytes of size when installed!!!!!!! this very frustrating...

How can this be avoided? i want to reduce the size of the apk

i am using proguard with this config to avoid google play services errors when generating a release signed apk:

-dontwarn com.google.android.gms.**

thanks

2

2 Answers

7
votes

Using Android Studio, you can take advantage of the split Google Play Services libraries, ensuring you only include the part of Google Play Services necessary for what you need. In your case, you could use

compile 'com.google.android.gms:play-services-ads:6.5.87'

Instead of the full play-services dependency which should reduce your APK size tremendously.

Using ProGuard and resource shrinking allows you to remove unused code and resources from your application, even further reducing the size of libraries you use to only the bare minimum.

0
votes

Google play service is the parent of many services i.e.

  1. Google Maps
  2. Google Plus
  3. Wallet
  4. Google SignIn

and many more. All google services are available here Google play services. So you should use specific service gradle. If you want to use Ad service of google then in gradle you have to use

implementation 'com.google.android.gms:play-services-ads:15.0.0'