You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "David Martinez Borque (JIRA)" <ji...@apache.org> on 2016/09/02 07:37:20 UTC

[jira] [Reopened] (CB-11742) After upgrading to version 6.3.1, apps won't install in Android because they are detected as DOWNGRADE

     [ https://issues.apache.org/jira/browse/CB-11742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Martinez Borque reopened CB-11742:
----------------------------------------

I understand you removed some stupid code, but in the process, it looks like you broke something else (?).

I mean, with the new cordova version, compiled apks won't upgrade previously installed Android apps.
Which is your proposed solution to this?
Am I the only developer with this problem?

> After upgrading to version 6.3.1, apps won't install in Android because they are detected as DOWNGRADE
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CB-11742
>                 URL: https://issues.apache.org/jira/browse/CB-11742
>             Project: Apache Cordova
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Android
>    Affects Versions: 6.3.1
>         Environment: Developing on Windows 8.1 with node v5.1.0, cordova 6.3.1 for android
>            Reporter: David Martinez Borque
>              Labels: android, triaged
>
> I have updated to cordova 6.3.1
> Then I compile all my apps, generating new release apks (v.1.17).
> Then I try to install the new apk into an android device where I already have an older version of the app (v 1.16)
> When upgrading the app (adb install -r android-release.apk) I always get this error:
> [INSTALL_FAILED_VERSION_DOWNGRADE]
> Most curiously, when I install the new apk  (with adb install -r -d) the Android system detects that the version of the app is 1.17!!
> ----------------------------> further on...<---------------------------
> I found a workaround for this problem. I modified the build.gradle file from:
> {code}
>     /*
>     ELSE NOTHING! DON'T MESS WITH THE VERSION CODE IF YOU DON'T HAVE TO!
>     else if (!cdvVersionCode) {
>       def minSdkVersion = cdvMinSdkVersion ?: privateHelpers.extractIntFromManifest("minSdkVersion")
>       // Vary versionCode by the two most common API levels:
>       // 14 is ICS, which is the lowest API level for many apps.
>       // 20 is Lollipop, which is the lowest API level for the updatable system webview.
>       if (minSdkVersion >= 20) {
>         defaultConfig.versionCode += 9
>       } else if (minSdkVersion >= 14) {
>         defaultConfig.versionCode += 8
>       }
>     }
> */
> {code}
> to:
> {code}
>     /*
>     ELSE NOTHING! DON'T MESS WITH THE VERSION CODE IF YOU DON'T HAVE TO!
> */
>     else if (!cdvVersionCode) {
>       def minSdkVersion = cdvMinSdkVersion ?: privateHelpers.extractIntFromManifest("minSdkVersion")
>       // Vary versionCode by the two most common API levels:
>       // 14 is ICS, which is the lowest API level for many apps.
>       // 20 is Lollipop, which is the lowest API level for the updatable system webview.
>       if (minSdkVersion >= 20) {
>         defaultConfig.versionCode = Integer.parseInt(defaultConfig.versionCode + '9')
>       } else if (minSdkVersion >= 14) {
>         defaultConfig.versionCode = Integer.parseInt(defaultConfig.versionCode + '8')
>       }
>     }
> {code}
> With this, the generated apk is not detected as a downgrade, and when I check the app version in Settings of the Android device, it shows the correct version number.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org