If you checked your developer console in the last hour, you will have noticed that the Android Market now allows developers to upload multiple APKs of the same app.

We all know the problem: The Android platform has a huge variety of devices and screen densities. Hence, all apps should support four pixel densities and every image needs to be saved in four sizes. This results in apps much bigger than they have to be. Now, this problem is solved. From now on it is possible to upload different APKs with the same packagename and different filters to support the fitting app to the users device. This can shrink the apps size dramatically.

Here is how it works:

  1. All APKs need to have the same packagename and must be signed with the same certificate key.
  2. All APKs need to have a different version code.
  3. The filters used to differentiate between your APKs are screen size, Open GL texture format and API level.
  4. These filters must not all be equal over the different APKs.
  5. If there is a case when only the API level differenciates two APKs, the APK with the higher API level needs to have the higher version code. Let me explain this: An Android device recognizes available updates only via the version code, so when a version code of an app available on the market is < than the version code of an app with an identical packagename on a device, an update is available. Now imagine this: You install an app with a version code = 4 and an API level = 7. There are Multiple APKs available, the other one being for API level = 8 with a version code 3. Now the device gets an update to API level 8. There is a new APK available, but the version code of that new APK is lower than that of the APK currently installed, therefore no available update will be identified. To avoid thas error, this rule has to be adhered to.
  6. To get everything done correctly, the Android Market team suggests a scheme for the version code of an app:
    Suggested version code scheme

    Suggested version code scheme

     

Keeping all this in mind you are ready to upload multiple APKs to the Android Market. Simply go to the new APK files tab and choose advanced mode. Choose activate on all the APKs you want to be delivered.

Conclusion

Now it is possible to publish an app in different forms for the different devices on the Android Market. Unfortunately there are no tools supporting this yet and maintaining many codebases takes a lot of time. Producing one APK for all devices is still considered best practice, but the developers can decide on their own.

Please tell me what you think of the new Android Market feature in the comments.