问题
My app is developped/published with Cordova and Crosswalk. Crosswalk generates an apk for ARM cpus and another one for x86 cpus.
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.
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.
However, it seems to require the use of an "Application.mk" file that the Cordova project structure doesn't seem to have by default.
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 ?
回答1:
It's absolutily possible. This feature receve the name of: Multiple APK
You don't need to use the 'Application.mk'
The process is simple:
- 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)
- Upload the two APK
- 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.
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. If it not happens for you, you can try to change de android:versionCode directly on the AndroidManifest.xml file. 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
android:versionCode="102"
And in x86 apk the
android:versionCode="104"
References:
Android Multiple APKs DOC
Maintaining Multiple APKs DOC
回答2:
I`m doing simple way. Example your main v code is 102, so you build first arm with 102 v code, and upload. Until upload runs, you can go change v code in manifest and in build grade to 103 and build another one x86. Easy and simple.
回答3:
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). Google Play auto-detected that they were targeted to different native platforms, and allowed both to be entered into production.
回答4:
The cordova-crosswalk doc instructs how to make an apk that works for both arm and x86. The problem is that it makes a huge 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
For arm you'd put this line in Application.mk :
APP_ABI := armeabi armeabi-v7a
And for 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).
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.
To build the project use
platforms\android\cordova\build.bat -release
instead of
cordova build android --release
来源:https://stackoverflow.com/questions/28706892/how-can-i-publish-to-play-store-the-x86-and-arm-apks-of-my-cordova-crosswalk-app