1

I tried to use Fastlane to deploy my Ionic App on playstore (track alpha) but I have this error :

[15:03:33]: Preparing to upload for language 'fr-FR'...
[15:03:34]: Preparing apk at path 'platforms/android/app/build/outputs/apk/release/android-release.apk' for upload...
+------------------+----------------+
|           Lane Context            |
+------------------+----------------+
| DEFAULT_PLATFORM | ios            |
| PLATFORM_NAME    |                |
| LANE_NAME        | android_deploy |
+------------------+----------------+
[15:04:41]: Google Api Error: apkUpgradeVersionConflict: APK specifies a version code that has already been used.

+------+----------------------------+-------------+
|                fastlane summary                 |
+------+----------------------------+-------------+
| Step | Action                     | Time (in s) |
+------+----------------------------+-------------+
| 1    | Verifying fastlane version | 0           |
| 2    | default_platform           | 0           |
| 3    | ionic                      | 126         |
|    | supply                     | 70          |
+------+----------------------------+-------------+

[15:04:41]: fastlane finished with errors

[!] Google Api Error: apkUpgradeVersionConflict: APK specifies a version code that has already been used.

I tried to increment manually my android-versionCode but nothing better :

<widget android-versionCode="3" id="com.myCompagny.myApp" version="0.0.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

For my versionCode I tried "4" and "103" but nothing better. (Like this)

What can I do to solve that ?

My Ionic info :

Ionic:

   ionic (Ionic CLI)  : 4.2.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.0.0, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.0.5, cordova-plugin-ionic-webview 1.1.1, (and 9 other plugins)

System:

   ios-deploy : 2.0.0
   NodeJS     : v8.9.4 (/usr/local/bin/node)
   npm        : 6.4.1
   OS         : macOS High Sierra
   Xcode      : Xcode 9.2 Build version 9C40b

Fastlane V : 2.108.0

V. Pivet
  • 1,320
  • 3
  • 25
  • 57

3 Answers3

0

You should change not only the AndroidManifest.xml android-versionCode, also the build.gradle versionCode to a greater number than the one on Google Play.

As you use fastlane I recomment you to use google_play_track_version_codes to get the last code version Google Play and android versioning plugin (look at the refs) that automatically changes your code version. In that way you can take the Google Play one, sum 1 and upload it without any problem

refs: https://docs.fastlane.tools/actions/google_play_track_version_codes/ https://github.com/otkmnb2783/fastlane-plugin-android_versioning

rcarba
  • 667
  • 7
  • 22
0

You're uploading an apk with the same version, in order to fix this open up your ionic config.xml file and change the version attribute on line 2 to a greater version.

From:

<widget id="com.company.appname" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

To:

<widget id="com.company.appname" version="1.1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

Then compile it again to get the new build version.

0

As per cordova's documentation versioCode

Expressed in major/minor/patch notation.

For example version 30.20.48 would be written as 302048. The way you have incremented it, the app is on version 3 right now. Try setting the versionCode as recommended and you should be fine.

Read More: config.xml - https://cordova.apache.org/docs/en/latest/config_ref/ Android

Platform Guide - https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#setting-the-version-code

Delwyn Pinto
  • 614
  • 1
  • 6
  • 14