android-Maintaining Multiple APKs,Creating Multiple APKs for Different API Levels

来源:互联网 发布:unity常用算法 编辑:程序博客网 时间:2024/05/09 04:45

 Multiple APK support is a feature of Google Play that allows you to publish multiple APKs under the same application listing. Each APK is a complete instance of your application, optimized to target specific device configurations. Each APK can target a specific set of GL textures, API levels, screen sizes, or some combination thereof.

》Creating Multiple APKs for Different API Levels

 When developing your Android application to take advantage of multiple APKs on Google Play, it’s important to adopt some good practices from the get-go, and prevent unnecessary headaches further into the development process.

 》If you can manage it, confining your application to a single APK has several advantages, including:

  • Publishing and testing are easier
  • There’s only one codebase to maintain
  • Your application can adapt to device configuration changes
  • App restore across devices just works
  • You don’t have to worry about market preference, behavior from "upgrades" from one APK to the next, or which APK goes with which class of devices

Note: While the implementation details of how to create and include library projects are beyond the scope of this lesson, you can get up to speed quickly on their creation at the following links:

  • Managing Projects from Android Studio
  • Managing Projects from the Command Line
 When a user downloads an application which uses multiple APKs through Google Play, the correct APK to use is chosen using two simple rules:
  • The manifest has to show that particular APK is eligible
  • Of the eligible APKs, highest version number wins

 Before uploading to Google Play, double-check the following items. Remember that these are specifically relevant to multiple APKs, and in no way represent a complete checklist for all applications being uploaded to Google Play.

  • All APKs must have the same package name
  • All APKs must be signed with the same certificate
  • If the APKs overlap in platform version, the one with the higher minSdkVersion must have a higher version code
  • Double check your manifest filters for conflicting information (an APK that only supports cupcake on XLARGE screens isn’t going to be seen by anybody)
  • Each APK's manifest must be unique across at least one of supported screen, openGL texture, or platform version
  • Try to test each APK on at least one device. Barring that, you have one of the most customizable device emulators in the business sitting on your development machine. Go nuts!

 By adding the required permission SEND_SMS, the feature requirement of android.hardware.telephony was implicitly added. Since API 11 is Honeycomb (the version of Android optimized specifically for tablets), and no Honeycomb devices have telephony hardware in them, Google Play will filter out this APK in all cases, until future devices come along which are higher in API level AND possess telephony hardware.

Fortunately this is easily fixed by adding the following to your manifest:

<uses-feature android:name="android.hardware.telephony" android:required="false" />
 Once you’ve completed the pre-launch checklist, upload your APKs to Google Play. It may take a bit for the application to show up when browsing Google Play, but when it does, perform one last check. Download the application onto any test devices you may have, to make sure that the APKs are targeting the intended devices. Congratulations, you’re done!
0 0
原创粉丝点击