简体   繁体   English

我如何发布我的cordova-crosswalk app的x86和ARM apks?

[英]How can I publish to play store the x86 and ARM apks of my cordova-crosswalk app?

My app is developped/published with Cordova and Crosswalk. 我的应用程序是使用Cordova和Crosswalk开发/发布的。 Crosswalk generates an apk for ARM cpus and another one for x86 cpus. Crosswalk为ARM cpus生成一个apk,为x86 cpus生成另一个apk。

At the moment, when I upload my ARM apk to the play store and then try to upload the x86 one, it prevents me from doing so and display a message that says that I cannot have two apk with the same version code. 目前,当我将我的ARM apk上传到Play商店然后尝试上传x86时,它阻止我这样做并显示一条消息,说我不能拥有两个具有相同版本代码的apk。

It seems it's possible to upload on the play store multiple apk files for the same version of an application byt filtering the devices targetted by each apk file. 通过过滤每个apk文件所针对的设备,似乎可以在Play商店上传多个apk文件用于相同版本的应用程序。

However, it seems to require the use of an "Application.mk" file that the Cordova project structure doesn't seem to have by default. 但是,它似乎需要使用Cordova项目结构默认情况下似乎没有的“Application.mk”文件。

How can I include an Application.mk file within my apks so that both the ARM and the x86 with the same version code will be uploadable to the Play store ? 如何在我的apks中包含Application.mk文件,以便ARM和具有相同版本代码的x86都可以上传到Play商店?

It's absolutily possible. 这是绝对可能的。 This feature receve the name of: Multiple APK 此功能获得了以下名称: 多个APK

You don't need to use the 'Application.mk' 您不需要使用'Application.mk'

The process is simple : 过程很简单

  1. In Developer Console, switch to Advanced Mode (click the Switch to advanced mode button at the top right of the APK tab - note that you must have uploaded at least one APK for that button to appear) 在开发者控制台中,切换到高级模式 (单击APK选项卡右上角的切换到高级模式按钮 - 请注意,您必须上传至少一个APK才能显示该按钮)
  2. Upload the two APK 上传两个APK
  3. Publish! 发布!

There's some rules to use multiple APK, but if you use the files generated by cordova crosswalk, you have nothing to worry about. 使用多个APK有一些规则,但如果您使用cordova crosswalk生成的文件,则无需担心。

The problem that you described with version code , happens beacuse each app must have a different version code . 您使用版本代码描述的问题,因为每个应用程序必须具有不同的版本代码 In my case, I use ionic framework (extends cordova) and in the build process, it generated a diferent version code por each apk, so I had no problem. 在我的情况下,我使用离子框架(扩展cordova),并在构建过程中,它为每个apk生成了不同的版本代码,所以我没有问题。 If it not happens for you, you can try to change de android:versionCode directly on the AndroidManifest.xml file. 如果不适合您,您可以尝试直接在AndroidManifest.xml文件中更改de android:versionCode Here is how my manifest looks like: 以下是我的清单的样子:

<manifest 
  android:hardwareAccelerated="true" 
  android:versionCode="102" 
  android:versionName="0.1.2" 
  package="br.org.yyyyyyy.xxxxxxxxxx"   
  xmlns:android="http://schemas.android.com/apk/res/android">

In my case, the arm7 apk, the 在我的情况下,arm7 apk,

android:versionCode="102" 机器人:的versionCode = “102”

And in x86 apk the 并在x86 apk中

android:versionCode="104" 机器人:的versionCode = “104”

References: 参考文献:

Android Multiple APKs DOC Android Multiple APK DOC

Maintaining Multiple APKs DOC 维护多个APK DOC

I`m doing simple way. 我做的很简单。 Example your main v code is 102, so you build first arm with 102 v code, and upload. 主要v代码的示例是102,因此您使用102 v代码构建第一个arm并上载。 Until upload runs, you can go change v code in manifest and in build grade to 103 and build another one x86. 在上传运行之前,您可以将清单和构建等级中的v代码更改为103并构建另一个x86。 Easy and simple. 简单易用。

I think things have changed in the past year. 我认为过去一年情况发生了变化。 I used the same version code and uploaded both apks (one at a time - in the normal way). 我使用了相同的版本代码并上传了两个apks(一次一个 - 以正常方式)。 Google Play auto-detected that they were targeted to different native platforms, and allowed both to be entered into production. Google Play会自动检测到它们是针对不同的原生平台,并允许两者都进入生产阶段。

The cordova-crosswalk doc instructs how to make an apk that works for both arm and x86. cordova-crosswalk doc指示如何制作适用于arm和x86的apk。 The problem is that it makes a huge apk. 问题是它制作了一个巨大的apk。

If you really want to make two apks, you can try (sorry not tested yet) to create the Application.mk file in the folder platforms/android/jni 如果你真的想做两个apks,你可以尝试(抱歉还没有测试)在文件夹platforms / android / jni中创建Application.mk文件

For arm you'd put this line in Application.mk : 对于arm你要把这行放在Application.mk中:

APP_ABI := armeabi armeabi-v7a

And for intel x86 : 对于intel x86:

APP_ABI := x86

And you have to change AndroidManifest.xml to have a different version for each platform (following the instructions in the link you provided). 您必须更改AndroidManifest.xml以使每个平台具有不同的版本(遵循您提供的链接中的说明)。

Be carefull, if you run cordova build android again, it will probably replace all the content of platforms/android, and your changes will be lost. 小心,如果你再次运行cordova build android,它可能会取代所有平台/ android的内容,你的更改将会丢失。

To build the project use 构建项目使用

platforms\android\cordova\build.bat -release 

instead of 代替

cordova build android --release

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

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