random random - 1 year ago 124
Android Question

Publishing multiple apks with different filters for mobile and tv

I want to publish multiple apks: one for mobile and other androidtv within same application. As per Publishing Multiple APKs with Different Filters there are only four distinguishing filters within same application:

Currently, Google Play allows you to publish multiple APKs for the
same application only when each APK provides different filters based
on the following configurations:

  • OpenGL texture compression formats

  • Screen size (and, optionally, screen density)

  • API level

  • CPU Architecture (ABI)

All other filters still work the same as usual, but these four are the
only filters that can distinguish one APK from another within the same
application listing on Google Play. For example, you cannot publish
multiple APKs for the same application if the APKs differ only based
on whether the device has a camera.

I thought to distinguish by API levels and screen size but there seems to be an overlap:

  1. API level (MinSDK) for androidtv app is kept at 21 and for mobile app at 16. So there is a overlap of API levels (21 and above).

  2. Screen size for android tv may overlap with that of tablet's:
    For eg.
    The common high-definition TV display resolutions are 720p, 1080i, and 1080p.
    Also Samsung nexus resolution is 720x1280.

I fear if I publish androidtv apk with a higher version, it might replace mobile app on a tablet with API level >= 21 and screen size 720x1280 that also qualifies for tv app layout size.

So how can I clearly differentiate between these two apks using different filters in app's manifest?


I already added leanback feature in androidtv app's manifest

<uses-feature android:name="android.software.leanback"
android:required="true" />

I see 42 supported devices for androidtv apk (can't see which devices) and 10791 for mobile apk device and total of 10832 total devices supported for entire application.

10791 + 42 = 10833

So there is still a possibility of 1 (10833 - 10832 = 1) overlapping device because of which warning is displayed.

overlap warning

enter image description here

androidtv apk

enter image description here

mobile apk

enter image description here

total devices

enter image description here

I don't think overlapping message is because of androidtv apk being a super-set of mobile apk as mentioned in one of comments looking at number of supported devices for androidtv which is much less.

Since there is just one possible overlapping device I will publish it but I wish I had known which devices overlap to receive both apks.

Answer Source

There actually is a "feature" that is used to specifically target Android TV. You can view the instructions in the docs. But basically you just have to specify that it uses the leanback feature like below.

    <uses-feature android:name="android.software.leanback"
        android:required="true" />

This will ensure that any TV device running leanback will get your APK (you can set required=false if you're using one APK). I believe that all official Android TVs are using this feature. It's possible leanback can be on a non-tv device, but in that case all of their apps will be showing up as TV apps.

There are several other features you can disable/enable to target Android TV, you can review the release checklist for more info (specifically this section).

One thing to note is that there are some overlapping devices that both your mobile and TV APK may satisfy. After speaking with a rep on the Play Console team, they recommended the way to get around it:

Regarding the multi-apk scenario where you have overlapping devices - yes, your Android TV APK would always need to have a higher version code. There are a few options to help resolve this:

  1. You can manually blacklist the 2 overlapping devices. This would immediately resolve the issue with overlapping APKs, however if new devices are released in the future that are eligible for both APKs you would face this issue again.

  2. Use a version code scheme for your Android TV APK that is significantly higher than your mobile device APK. For example, your TV APK can be existing version code + 100000, or 100808, while your mobile device APK remains at 838. In this scenario, you could publish mobile device APKs up to version code 100808 without having to update your Android TV APK with every push. This would also resolve any issues with Alpha/Beta testing Android TV APKs.

His response is also covered in the "Assigning version codes" section of this doc.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download