We have written a new version of an Android app to upgrade an old one, but would like to extract login username from old apps SharedPreferences on first run after upgrade before overwriting the whole thing with the new data model. build.gradle of the new codebase specifies a newer versionName and versionCode, yet when we try to run from Android Studio onto a device that had the old app installed we get a dialog box with the following error message:
Installation failed since the device already has a newer version of this application.
In order to proceed, you have to uninstall the existing application.
WARNING. Uninstalling will removed the application data!
Do you want to uninstall the existing application?
[OK] [Cancel]
Obviously if we accept it uninstalls the old app along with all the user data and we cannot achieve what we intended.
Cannot find anything on the internet regarding this problem
OLD APP build.gradle:
versionCode 1
versionName '1.4.1'
NEW APP build.gradle:
versionCode 2
versionName '2.0.0'
I believe this error is happening because your old APP has a higher versionCode
than your new app.
So, you must update versionCode
from your new app to a higher (or at least equal) value if compared to your oldAPP.
In the new app:
build.grade
android {
...
defaultConfig {
...
versionCode 2
versionName "1.1"
}
...
}
If your oldVersion was built in Eclipse, versionCode was probably defined in AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="string"
android:versionCode="integer"
android:versionName="string"
. . .
</manifest>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With