使用人行横道为 32 位和 64 位平台构建多个 APK 时,APK 版本代码顺序不正确 [英] Incorrect APKs versionCode order when building multiple APKs for both 32bit and 64 bit platforms with crosswalk

查看:16
本文介绍了使用人行横道为 32 位和 64 位平台构建多个 APK 时,APK 版本代码顺序不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为 32 位(armeabi-v7a 和 x86)和 64 位(arm64-v8a 和 x86_64)平台构建 ionic/cordova 应用程序.我使用命令 ionic build android --releaseionic build android --release --xwalk64bit 构建了四个单独的 APK一切顺利,除了 versionCode(版本设置为 0.0.11)有点偏离 - 见下文

I need to build the ionic/cordova application for both 32bit (armeabi-v7a and x86) and 64bit (arm64-v8a and x86_64) platforms. I build four separate APKs using commands ionic build android --release and ionic build android --release --xwalk64bit All goes well except that the versionCode (for version set to 0.0.11) is a little off - see below

问题是 x86 和 x86_64 必须具有比 ARM apk 更高的 versionCode.这是必需的,因为 x86 设备能够处理 ARM 库,但没有能够处理 x86 库的 ARM 设备.所以我们必须保持x86 APK的版本号高于ARM apk的版本号,正确的APK才会跑到正确的设备上.

The problem is that x86 and x86_64 must have higher versionCode then ARM apks. This is required because x86 devices are able to handle ARM libs but there is no ARM device able to handle x86 libs. So we must keep the version code of x86 APK higher than the one of ARM apk, and the right APK will go to the right device.

这是我正在寻找的(以及我最终设法创建的) - 见下文

Here is what I'm looking for (and what I finally managed to create) - see below

问题是 versionCode 由 build.gradle 设置并由 crosswalk mobile-xwalk.gradle 修改,这使用我上面描述的构建方法给出了错误的版本.我尝试使用 config.xml 中的 android-versionCode 参数设置 versionCode,并使用 cdvVersionCode for build.gradle(参见 http://cordova.apache.org/docs/en/6.x/guide/platforms/android/index.html#configuring-gradle) 但没有运气.

The problem is that the versionCode is set by both build.gradle and modified by crosswalk mobile-xwalk.gradle which gives the wrong versions using my build approach described above. I tried to set the versionCode using android-versionCode param in config.xml and using cdvVersionCode for build.gradle (see http://cordova.apache.org/docs/en/6.x/guide/platforms/android/index.html#configuring-gradle) but no luck.

我最终通过手动更改 mobile-xwalk.gradle 来为 64 位 apk 设置正确的版本代码来解决问题(如我的第二个屏幕截图所示).这对我来说似乎不是最佳解决方案

I end up to fix the problem by manually changing mobile-xwalk.gradle to set the correct versionCodes for 64bit apks (as shown on my second screenshot). This does not look like the optimal solution for me

问题 - 有没有更好的方法来解决这个问题?

Question - are there any better way to approach this problem?

推荐答案

cordova-plugin-crosswalk-webview 中似乎存在一个错误.此代码部分来自平台/android/build.gradle(用于构建 32 位):

It seems there is a bug in cordova-plugin-crosswalk-webview. This code part from platforms/android/build.gradle (used to build 32-bit):

productFlavors {
        armv7 {
            versionCode defaultConfig.versionCode*10 + 2
            ndk {
                abiFilters "armeabi-v7a", ""
            }
        }
        x86 {
            versionCode defaultConfig.versionCode*10 + 4
            ndk {
                abiFilters "x86", ""
            }
        }
        all {
            ndk {
                abiFilters "all", ""
            }
        }
    }

这里是 versionCode*10 所见......这个代码部分来自平台/android/cordova-plugin-crosswalk-webview/YOUR_APP_SUFFIX-xwalk.gradle(用于构建 64 位):

here is versionCode*10 as seen... And this code part from platforms/android/cordova-plugin-crosswalk-webview/YOUR_APP_SUFFIX-xwalk.gradle (used to build 64-bit):

productFlavors {
            x86_64 {
                versionCode defaultConfig.versionCode + 6
                ndk {
                   abiFilters "x86_64", ""
                }
            }
            arm64 {
                versionCode defaultConfig.versionCode + 9
                ndk {
                    abiFilters "arm64-v8a", ""
                }
            }
        }

这里只是versionCode.所以我通常将第二个文件更改为 versionCode*10 来解决 PlayMarket 问题

and here is just versionCode. So I usually change second file to versionCode*10 to solve PlayMarket issues

这篇关于使用人行横道为 32 位和 64 位平台构建多个 APK 时,APK 版本代码顺序不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆