简体   繁体   English

使用矢量资产部署多个APK(android)

[英]Deploying multiple APK with vector asset (android)

android studio is currently supporting vector assets . android studio目前支持矢量资产 according to the literature I can 根据文献我可以

Create separate APKs for different API levels. 为不同的API级别创建单独的APK。 When you don't include the corresponding raster images in the APK for Android 5.0 (API level 21) and higher, the APK can be much smaller in size. 如果您在Android 5.0(API级别21)及更高版本的APK中未包含相应的栅格图像,则APK的大小可能会小得多。 For more information, see Multiple APK Support. 有关更多信息,请参阅多个APK支持。

so I tried creating 2 APIs: - 所以我尝试创建2个API:-

  • the pre-lollipop version contains the generated pngs without the vector assets, 棒棒糖之前的版本包含不包含矢量素材的生成的png,
  • while the lollipop version contains only the vectors assets 而棒棒糖版本仅包含vectors资产

In http://developer.android.com/google/play/publishing/multiple-apks.html http://developer.android.com/google/play/publishing/multiple-apks.html中

If an APK you've uploaded for API levels 4 and above (Android 1.6+) has a version code of 0400, then an APK for API levels 8 and above (Android 2.2+) must be 0401 or greater. 如果您为API级别4和更高版本(Android 1.6+)上传的APK的版本代码为0400,则API级别8和更高版本(Android 2.2+)的APK必须为0401或更高。 In this case, the API level is the only supported filter used, so the version codes must increase in correlation with the API level support for each APK, so that users get an update when they receive a system update. 在这种情况下,API级别是使用的唯一受支持的过滤器,因此必须与每个APK的API级别支持相关地增加版本代码,以便用户在收到系统更新时获得更新。

The following is my gradle build file. 以下是我的gradle构建文件。

compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
    applicationId "twitch.angelandroidapps.matchit"
}
productFlavors { 
    lollipopConfig {
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 3
        versionName "21.1.0"
    }
    preLollipopConfig {
        minSdkVersion 10
        maxSdkVersion 20
        targetSdkVersion 17
        versionCode 2
        versionName "10.1.0"
    }
} 
:
//snipped the rest of the build config...
:

however, when I deploy the pre-lollipop version first, followed by the lollipop version, then the pre-lollipop version got archived (and vice-versa). 但是,当我先部署棒棒糖之前的版本,然后再部署棒棒糖版本时,则存档了棒棒糖之前的版本(反之亦然)。

Any advice on how I can get both versions to be deployed in the play store? 关于如何在Play商店中部署两个版本的任何建议?

I had it figured out. 我知道了。

When i first deploy the lollipops and pre-lollipops, they get auto-archived. 当我第一次部署棒棒糖和棒棒糖时,它们会自动存档。

For some strange reason, I have to manually shift the pre-lollipop version back into production by clicking "Move to Prod" for it to work. 出于某些奇怪的原因,我必须通过单击“移至产品”手动将棒棒糖之前的版本重新投入生产。

在此输入图像描述

After that, the playstore will show a new "API LEVELS" column. 之后,Playstore将显示一个新的“ API LEVELS”列。

在此输入图像描述

Also the literature about having a larger versionCode seems to be wrong. 同样,有关具有较大版本代码的文献似乎是错误的。 Pre-lollipop version needs to always be a lower VersionCode (probably because my API levels do not overlap?). 棒棒糖之前的版本必须始终是较低的VersionCode(可能是因为我的API级别不重叠?)。 Anyway, I can now deploy new pre-lollipop versions without getting the previous version archived. 无论如何,我现在可以部署新的棒棒糖之前版本,而无需存档以前的版本。

在此输入图像描述

In the end, I used the naming convention of 最后,我使用了

  • 21xxxx for lollipop versions and 棒棒糖版本为21xxxx,以及
  • 10xxxx for pre-lollipop versions 棒棒糖之前的版本为10xxxx

在此输入图像描述

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM