2
votes

In my app i have too many images in res, so now the size of apk has become huge(70 MB). Is it possible to upload different apk files for MDPI, HDPI, XHDPI and XXHDPI phones. And will google play handls if a HDPI phone user is downloading my app, He should only get the HDPI version of my app. (And same for MDPI/XHDPI/XXHDPI.)

EDIT:

I have created 4 different APK files (for mdpi, hdpi, xhdpi, xxhdpi) successfully. I just added below code to manifest for all hdpi devices:

<compatible-screens>
    <screen
        android:screenDensity="hdpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="large" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="xlarge" />
</compatible-screens>

and same i did for xhdpi and xxhdpi.

Now the problem is, i am trying to upload my 4 apk files (of same app) on Google play. But i am unable to find such feature that allows me to upload 4 apks of same app. I only found the option by which i can upload one apk file.

Please guide me how to upload 4 different apks (each for mdpi, hdpi, xhdpi, xxhdpi) of same app on Google play.

1
I think if you play with <support-screens> in the manifest you could do it.Marco Acierno
I would recommended to you used Expansion APK features over here becoz your apk size > 50MBM D
Yes you can create multiple APKs. Documents says "Multiple APK support is a feature on Google Play that allows you to publish different APKs for your application that are each targeted to different device configurations". Read more: Multiple APK SupportParesh Mayani
@PareshMayani thanks ... and sorry for late reply.. today i will try uploading different apks.Harsh
@Harsh sure, if it will help you out then please share your experience by posting answer with all the possible detail, so it can help someone else too.Paresh Mayani

1 Answers

1
votes

Yes, you can build multiple APK's to reduce download size (source)

In your case:

android {
  ...
  splits {

    // Configures multiple APKs based on screen density.
    density {

      // Configures multiple APKs based on screen density.
      enable true

      reset()  // Clears the default list from all densities to no densities.
      include "mdpi", "hdpi", "xhdpi", "xxhdpi" // Specifies the two densities we want to generate APKs for.
    }
  }
}

or you could just exclude the densities you don't want:

android {
  ...
  splits {
    density {    
      enable true
      exclude "ldpi", "xxxhdpi"
    }
  }
}

Then, when you do an assembleRelease, you'll get an APK per density + one universal APK. If you don't want the universal APK, specify universalApk false.

Likewise, if you have native libraries, you can also create a different APK per ABI.