MS AppCenter CodePush not updating

1.5k views Asked by At

I'm trying to use MS AppCenter CodePush to push update to an Android app. I'm able to push updates to the CodePush server, and the app can see that there are updates, however it never decides to download and install the update. The current release of the App installed on the device is 4.2.4. If I push an update and target ^4.2.3 or 4.2.4 or 4.1 - 4.4 or * I see the following in the console:

[CodePush] Checking for update.
[CodePush] App is up to date.

However if I target 4.2.5 or higher, it says:

[CodePush] Checking for update.
[CodePush] An update is available, but it is targeting a newer binary version than you are currently running.
[CodePush] App is upp to date.

It seems there is nothing I can do to tell it that there is a new version applicable to what's installed. I have disabled all past releases (most of which never worked either) in case they are interfering.

Any tips for troubleshooting this?

2

There are 2 answers

1
Dylan Smith On

The problem was with the new release. In my project I had never changed the version number in the package.json from the default 1.0.0. I was only incrementing the version in the config.xml file. The docs say that it is the config.xml version that matters, but it seems they both do.

0
Tharindu Ketipearachchi On

Managing version numbers for android is really easy when you are using produt Flavors. You just need to change versions of Produt Flavor and it'll change every other files accordingly. First you need to add ProductFlavors for android/app/build.gradle like follows

productFlavors {
 prod {
   versionCode 1
   versionName "1.0.0"
   applicationId "com.tharindu.myapp"
   resValue "string", "build_config_package", "com.tharindu.myapp"
   resValue "string", "CodePushDeploymentKey", '"ENV_PROD_CODEPUSH_DEPLOYMENT_KEY"'
}
 test {
   versionCode 1
   versionName "1.0.0"
   applicationId "com.tharindu.myapp"
   resValue "string", "build_config_package", "com.tharindu.myapp"
   resValue "string", "CodePushDeploymentKey", '"ENV_TEST_CODEPUSH_DEPLOYMENT_KEY"'
}
 dev {
  versionCode 1
  versionName "1.0.0"
  applicationId "com.tharindu.myapp"
  resValue "string", "build_config_package", "com.tharindu.myapp"
  resValue "string", "CodePushDeploymentKey", '"ENV_DEV_CODEPUSH_DEPLOYMENT_KEY"'
}
}

This article explains you clearly how to config CodePush using Product Flavors.