Skip to content

Commit d5abc55

Browse files
scottamainddougherty
authored andcommitted
docs: update for multi apk doc for ABI support
1 parent 73ec048 commit d5abc55

File tree

1 file changed

+55
-13
lines changed

1 file changed

+55
-13
lines changed

docs/html/guide/google/play/publishing/multiple-apks.jd

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ page.title=Multiple APK Support
99
<ul>
1010
<li>Simultaneously publish different APKs for different
1111
device configurations</li>
12-
<li>Different APKs are distributed to different devices based on filters declared in the
13-
manifest file</li>
14-
<li>You should publish multiple APKs only when it's not possible or reasonable to
12+
<li>You should publish multiple APKs only when it's not possible to
1513
support all desired devices with a single APK</li>
1614
</ul>
1715

@@ -39,16 +37,17 @@ support all desired devices with a single APK</li>
3937
<li><a href="#TextureOptions">Supporting multiple GL textures</a></li>
4038
<li><a href="#ScreenOptions">Supporting multiple screens</a></li>
4139
<li><a href="#ApiLevelOptions">Supporting multiple API levels</a></li>
40+
<li><a href="#CpuArchOptions">Supporting multiple CPU architectures</a></li>
4241
</ol>
4342
</li>
4443
</ol>
4544

4645
<h2>See also</h2>
4746
<ol>
47+
<li><a href="{@docRoot}guide/google/play/expansion-files.html">APK Expansion Files</a></li>
4848
<li><a href="{@docRoot}guide/google/play/filters.html">Filters on Google Play</a></li>
4949
<li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></li>
50-
<li><a href="{@docRoot}tools/extras/support-library.html">Compatibility
51-
Package</a></li>
50+
<li><a href="{@docRoot}tools/extras/support-library.html">Support Library</a></li>
5251
<li><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">Android API Levels</a></li>
5352
</ol>
5453

@@ -76,22 +75,25 @@ many device configurations as possible, doing so is sometimes not possible. To h
7675
you publish your application for as many devices as possible, Google Play allows you to
7776
publish multiple APKs under the same application listing. Google Play then supplies each APK to
7877
the appropriate devices based on configuration support you've declared in the manifest file of each
79-
APK.</p>
78+
APK. </p>
8079

8180
<p>By publishing your application with multiple APKs, you can:</p>
8281

8382
<ul>
8483
<li>Support different OpenGL texture compression formats with each APK.</li>
85-
<li>Support different screen configurations with each APK.</li>
84+
<li>Support different screen sizes and densities with each APK.</li>
8685
<li>Support different platform versions with each APK.</li>
86+
<li>Support different CPU architectures with each APK (such as for ARM, x86, and MIPS, when your
87+
app uses the <a href="{@docRoot}tools/sdk/ndk/index.html">Android NDK</a>).</li>
8788
</ul>
8889

8990
<p>Currently, these are the only device characteristics that Google Play supports for publishing
9091
multiple APKs as the same application.</p>
9192

9293
<p class="note"><strong>Note:</strong> You should generally use multiple APKs to support
9394
different device configurations <strong>only when your APK is too large</strong> (greater than
94-
50MB). Using a single APK to support different configurations is always the best practice,
95+
50MB) due to the alternative resources needed for different device configurations.
96+
Using a single APK to support different configurations is always the best practice,
9597
because it makes the path for application updates simple and clear for users (and also makes
9698
your life simpler by avoiding development and publishing complexity). Read the section below about
9799
<a href="#SingleAPK">Using a Single APK Instead</a> to
@@ -283,14 +285,19 @@ higher, as per the previous note).</li>
283285
</ul>
284286
</div>
285287
</li>
288+
289+
<li><strong>CPU architecture (ABI)</strong>
290+
<p>This is based on the native libraries included in each APK (which are
291+
determined by the architectures you declare in the {@code Application.mk}
292+
file) when using the Android NDK.</p></li>
286293
</ul>
287294

288295
<p>Other manifest elements that enable <a
289296
href="{@docRoot}guide/google/play/filters.html">Google Play filters</a>&mdash;but are not
290297
listed above&mdash;are still applied for each APK as usual. However, Google Play does not allow
291-
you to publish multiple APKs based on variations of them. Thus, you cannot publish
292-
multiple APKs if the above listed filters are the same for each APK (but the APKs differ based on
293-
other characteristics in the manifest file). For
298+
you to publish separate APKs based on variations of those device characteristics. Thus, you cannot
299+
publish multiple APKs if the above listed filters are the same for each APK (but the APKs differ
300+
based on other characteristics in the manifest or APK). For
294301
example, you cannot provide different APKs that differ purely on the <a
295302
href="{@docRoot}guide/topics/manifest/uses-configuration-element.html">{@code
296303
&lt;uses-configuration&gt;}</a> characteristics.</p>
@@ -349,7 +356,8 @@ greater. In this case, the API level is the only supported filter used, so the v
349356
get an update when they receive a system update.</li>
350357
<li>If you have one APK that's for API level 4 (and above) <em>and</em> small -
351358
large screens, and another APK for API level 8 (and above) <em>and</em> large - xlarge screens, then
352-
the version codes <strong>must increase</strong>. In this case, the API level filter is used to
359+
the version codes <strong>must increase</strong> in correlation with the API levels.
360+
In this case, the API level filter is used to
353361
distinguish each APK, but so is the screen size. Because the screen sizes overlap (both APKs
354362
support large screens), the version codes must still be in order. This ensures that a large screen
355363
device that receives a system update to API level 8 will receive an update for the second
@@ -360,6 +368,21 @@ screens, then the version codes <strong>do not need to increase</strong> in corr
360368
levels. Because there is no overlap within the screen size filter, there are no devices that
361369
could potentially move between these two APKs, so there's no need for the version codes to
362370
increase from the lower API level to the higher API level.</li>
371+
<li>If you have one APK that's for API level 4 (and above) <em>and</em> ARMv7 CPUs,
372+
and another APK for API level 8 (and above) <em>and</em> ARMv5TE CPUs,
373+
then the version codes <strong>must increase</strong> in correlation with the API levels.
374+
In this case, the API level filter is used to
375+
distinguish each APK, but so is the CPU architecture. Because an APK with ARMv5TE libraries is
376+
compatible with devices that have an ARMv7 CPU, the APKs overlap on this characteristic.
377+
As such, the version code for the APK that supports API level 8 and above must be higher.
378+
This ensures that a device with an ARMv7 CPU that receives a system update to API level 8
379+
will receive an update for the second APK that's designed for API level 8.
380+
However, because this kind of update results in the ARMv7 device using an APK that's not
381+
fully optimized for that device's CPU, you should provide an
382+
APK for both the ARMv5TE and the ARMv7 architecture at each API level in order to optimize
383+
the app performance on each CPU.
384+
<strong>Note:</strong> This applies <em>only</em> when comparing APKs with the ARMv5TE and
385+
ARMv7 libraries, and not when comparing other native libraries.</li>
363386
</ul>
364387
</li>
365388

@@ -384,7 +407,12 @@ screens so that all previously-supported devices are still supported.</li>
384407
sizes small, normal, and large, while another APK supports sizes large and xlarge, there is an
385408
overlap, because both APKs support large screens. If you do not resolve this, then devices that
386409
qualify for both APKs (large screen devices in the example) will receive whichever APK has the
387-
highest version code.</li>
410+
highest version code.
411+
<p class="note"><strong>Note:</strong> If you're creating separate APKs for different CPU
412+
architectures, be aware that an APK for ARMv5TE will overlap with an APK for ARMv7. That is,
413+
an APK designed for ARMv5TE is compatible with an ARMv7 device,
414+
but the reverse is not true (an APK with only the ARMv7 libraries is
415+
<em>not</em> compatible with an ARMv5TE device).</li>
388416
</ul>
389417

390418
<p>When such conflicts occur, you will see a warning message, but you can still publish your
@@ -641,3 +669,17 @@ if (android.os.Build.VERSION.SDK_INT >= 11) {
641669
}
642670
</pre>
643671

672+
673+
<h3 id="CpuArchOptions">Supporting multiple CPU architectures</h3>
674+
675+
<p>When using the Android NDK, you can create a single APK that supports multiple CPU architectures
676+
by declaring each of the desired architectures with the {@code APP_ABI} variable in the
677+
<code>Application.mk</code> file.</p>
678+
679+
<p>For example, here's an <code>Application.mk</code> file that declares support for three
680+
different CPU architectures:</p>
681+
682+
<pre>
683+
APP_ABI := armeabi armeabi-v7a mips
684+
APP_PLATFORM := android-9
685+
</pre>

0 commit comments

Comments
 (0)