question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: Capacitor v3 configuration file: Add version and android-versionCode fields

See original GitHub issue

Feature Request

Description

While Capacitor tries to avoid changes to users’ native projects, I’ve seen this requested by the community several times and it’s a feature Cordova has. A lot of configuration details (like setting permission details or choosing an App’s name) are set once, so manual project changes aren’t a big deal. However, each time you ship an update to a native iOS/Android app in the app stores, the Version Number must be incremented. So, having “cap sync” update the version number (found in Cap config) in each native project would be a nice workflow improvement.

Current workflow (app is on version 1.0 for example):

  • Finish new feature
  • Submit to app stores (manually or via Appflow’s Deploy to app stores feature)
  • It fails, due to version number not incremented
  • Manually open Xcode and Android Studio, increment version number to v1.1.
  • repackage binary, resubmit to app stores

Platform(s)

ios, android

Preferred Solution

Supported fields could look something like:

// capacitor.config.json
{ 
  version: "1.2.5", 
  android-versionCode: "3"
}

New workflow:

  • Feature complete
  • Increment version number in capacitor.config.json.
  • npx cap sync to update native android/ios projects with new version number and code
  • profit (deploy to app stores)

Alternatives

Update android/ios projects manually.

Additional Context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nakroutcommented, Dec 29, 2021

Hi guys, I recommend also Capacitor Project API and Configuration Tool from ionic-team.

1reaction
distantecommented, Dec 17, 2020

I do this there:

import groovy.json.JsonSlurper

def jsonSlurper = new JsonSlurper()
def packageJson = jsonSlurper.parseText( file('../package.json').text)

ext {
    minSdkVersion = 23
    compileSdkVersion = 29
    ...
    ...
    cordovaAndroidVersion =  '7.0.0'
    appVersionCode = packageJson["versionCode"]
    appVersionName = packageJson["version"]
}

and my Android app version is central in my package.json and so is my global app version. In that way is easier to track version changes globally.

That is what I wanted to offer as PR maybe in capacitor.json instead of package.json (although I find package.json more central).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Updating to 3.0 | Capacitor Documentation
Guide for updating Capacitor from v2 to v3 in your app. ... Below is an example capacitor.config.ts file that is used in the...
Read more >
Capacitor versions - Quasar Framework
The officially supported versions of Capacitor are v1, v2 and v3. Upgrading Capacitor. If you previously used a lower version of Capacitor and...
Read more >
Version number added to download name - VoltBuilder
The version information comes from the first line of your config.xml file: <widget version="1.0.3" android-versionCode="1" id="com.nsbasic.
Read more >
Untitled
Brsm blog, Lagu2 terbaru, Mitralign crunchbase, Slam dunk tagalog version, ... Brz works filter, Scott munro thunder bay, Nam min seol, Append file...
Read more >
Auth0 Ionic & Capacitor (Angular) SDK Quickstarts: Login
This tutorial demonstrates how to add user login with Auth0 to an Ionic Angular & Capacitor application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found