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>
For testing you can change the version code to the one currently installed in the device.
#alex, Update "versionCode" ,"version name" in build.gradle. after complete clean proj and rebuild. Many time old all data not remove.
Ahh it looks like some gradle script from the old developers was overwriting the versionCode at build time with a much higher number... but now using a really high number I get INSTALL_FAILED_UPDATE_INCOMPATIBLE instead! :(
As it was mentioned in one of the comments above, it is purely because of the versionCode in the build.gradle
I too had the same issue. My old app had a version code of 7009 and the new one had 7010. However, the old app's version code was changed during build-time (7009 was just the base-apk code) so as soon as I changed versionCode to 17010 which was much greater than 7009, I could install the new app over the previous one without uninstalling.
To confirm, maybe just try Logging the versionCode in console from the old app and make sure that the new version code is greater than that.
In my case, I had multiple users on my device. The app got installed for all users. So I had to delete it for all of them.
I am having this issue for two years. I can't be able to upload android APK to play store. The app is written in phonegape and I compile the Signed APK from android studio.
What I am having error is:
Your APK's version code needs to be higher than 100008.
Facts:
There are nothing like 100008 word or number in whole project.
I changed All version codes to 100009, still same error
Android Studio uses Gradle to build your projects.
To increment the android version code using Gradle add the following to build.gradle in your app module:
defaultConfig {
minSdkVersion XX
targetSdkVersion YY
versionCode 100009
versionName "Your Version Name"
}
Replacing where necessary. The key part is the versionCode must be higher than what is already on the store.
I suggest you to decompile your apk and check a version in the result manifest file.
You may use this tool http://ibotpeaches.github.io/Apktool/
Hope it helps!
I guess you have read this already: https://developer.android.com/studio/publish/versioning.html
i know this has been ask here
The correct answer is to change the version does not solve my problem
id did added this two lines in my manifest
android:versionCode="2"
android:versionName="2.01"
but then when i clean and build using android studio the generate the apk again then upload the same error happend ..
Note: I did check that it is the correct file that i try to upload in the developer console
In the build.gradle file check if you have versionCode like
defaultConfig {
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
because if you have mentioned versionCode in build.gradle file then it will overwrite the values in manifest file. Please make sure if you have mentioned version code here then you have updated here also.
Change it in the build.gradle file of your app module in Android Studio.
Remove those from your manifest. Go to File>Project Structure> And either flavors or build types (don't remember and don't have my pc on me). Set the version name and version code from there.
Based on this Google document I'm expecting Gradle to update my manifest.xml file with a version number, notably this quoted section:
The defaultConfig element configures core settings and entries in the manifest file (AndroidManifest.xml) dynamically from the build system. The values in defaultConfig override those in the manifest file.
However when I change the version code or version name of my Gradle file, the values arent' changed in my manifest.
Is this normal behavior?
Which values, between the manifest and the gradle build, are stting version codes and names?
How can I make the connection between the manifest versions and the gradle build more visible?
Even I am facing the similar issue. It is the default behaviour of gradle system I guess. You need to update both AndroidManifest.xml and build.gradle seperately if there is any changes in sdk versions, version code, version name,etc. I am looking forward that these kinda issues must be fixed in upcoming releases.
I have versionCode(1.0.3) and versionName(8) in my build.gradle only and it had worked correctly for me in past.
Now I updated the versionCode to 1.0.4 and versionName to 1 but it kept on giving me error on Google play. I even tried adding the new versionCode and versionName to AndroidManifest.xml but it did not help. Only thing that worked was updating the versionName to a higher number (9). Something seems broken in the Google Play upload apk and verify mechanism. Hopefully my answer would save someone else's 1 hour for solving this silly bug.
According to this answer How to solve "Your APK's version code needs to be higher than 2." in Google Play's Developer Console? I have just changed the version code from 2 to 3 and it failed to upload the build.
This is my old manifest before I uploaded the apk
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mypackage name"
android:installLocation="auto"
android:versionCode="28"
android:versionName="1.0028" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
.....
here is the new version code which I have to upload on android developer console. See my menifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mypackage name"
android:installLocation="auto"
android:versionCode="2"
android:versionName="2.0001" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
......
I dont know whats the issue. Any help?
For people who use Android Studio the problem may be solved by editing versionCode and versionName in build.gradle instead of AndroidManifest.xml.
e.g.
defaultConfig {
applicationId "com.my.packageId"
minSdkVersion 15
targetSdkVersion 22
versionCode 2 <-- change this
versionName "2.0" <-- change this
}
android:versionCode="28"
Your previous versionCode was 28. You should increment it by 1 to 29.
android:versionCode="29"
Presumably, your previous app versions were 1 through 28. By releasing with versionCode 3, you are conflicting with a previous version of your app that was already released with this versionCode.
In my case it a simple issue. I have uploaded an app in the console before so I try re-uploading it after resolving some issues.
All I do is delete the previous APK from the App Bundle Explorer (formally called Artifact Library)
if you are using ionic framework, go to config.xml file and change the "version" attribute in the "widget" tag. increase the version number. then rebuild, sign and upload ur apk to play store. that fixed my problem.
This error appears when you try to upload an apk that has same version values as the one already on playstore.
Just change the following in your build.gradle file => versionCode and versionName
defaultConfig {
applicationId "com.my.packageId"
minSdkVersion 16
targetSdkVersion 27
versionCode 2 <-- increment this by 1
versionName "2.0" <-- this is the version that shows up in playstore,
remember that the versioning scheme goes as follows.
first digit = major breaking changes version
second digit = minor changes version
third digit = minor patches and bug fixes.
e.g versionName "2.0.1"
}
(For Flutter App) You need to use a different version code for your APK or Android App Bundle because you already have one with version code 1.
Don't be panic...
You need to change in Flutter Version from pubspec.yaml file and Version Code from local.properties file.
First go to your pubspec.yaml file. The first three lines should be name, description and version of App.
Before Release -
For you the version might look something like this:
version: 1.0.0+1
So before creating an apk for release (for update your exiting app on Google Play Console i.e for new update) make sure you increment this number by 1. (You should increment it as there's no requirement on increment step) .
Solution
Just change that version to (As per your need )
version: 1.0.1+2
And Second if
flutter.versionCode in Project -> android -> local.properties is
flutter.versionCode=1 then change it or upgrade it to the flutter.versionCode=2 or any other greater number than previous code.
And finally release the app as per documentation.
Sometimes the PlayStore encounters a bug when you upload an APK during a Release creation, and you are stuck because you cannot upload the same APK again, for the current draft release. You get the error "Upload failed..."
The solution is to go to the Artifact library menu, under Release management and to delete the draft artifact. Once this is done, you will be able to upload the APK again, and to finish your release.
Hope it will help others...
Ben
If you're using Building Standalone Apps with Expo, the versionCode error might creep up owing to the fact that the standard app.json config only has a reference to the version property.
I was able to add a versionCode property under android as follows:
Sample App.json
{
"expo": {
"sdkVersion": "29.0.0",
"name": "App Name",
"version": "1.1.0",
"slug": "app-name",
"icon": "src/images/app-icon.png",
"privacy": "public",
"android": {
"package": "com.madhues.app",
"permissions": [],
"versionCode": 2 // Notice the versionCode added under android.
}
}
}
Detailed documentation: https://docs.expo.io/versions/v32.0.0/workflow/configuration/#versioncode
In Android Studio 1.1.0, change versionCode in build.gradle for Module: app and don't necessarily change versionName:
android {
...
defaultConfig {
...
versionCode 3
versionName "1.0"
}
...
}
Just as Martin Konecny's answer said, you need to change the versionCode to something higher.
Your previous version code was 28. it should be changed to 29.
According to the document on the android developer website. a version code is
An integer value that represents the version of the application code, relative to other versions.
So it should be related(by related I mean higher) to the previous versionCode as noted by the document:
you should make sure that each successive release of your application uses a greater value.
As mentioned again in the document
the android:versionCode value does not necessarily have a strong resemblance to the application release version that is visible to the user (see android:versionName, below)
So even though this is the release 2.0001 of your app, it does not necessarily mean that the versionCode is 2.
Hope this helps :)
If you're using Android Studio, you could go:
Build -> Edit Flavors
And change the Version Code and Name from there.
if you are using phonegap / cordova applications, just edit your config.xml and add the android-versionCode and version in the widget.
<widget id="com.xxx.yyy" version="1.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"
android-versionCode="100001"
version="1.0.1">
2021! For Flutter developers!
in your pubspec.yaml:
Detailed answer is here
Don't put feedback after!
Last Updated 18-12-2021:
Go to Google Play Console if you want to delete or revised same version and choose “App Bundle Explorer”:
Pick the version:
If you have build version that not been released yet, you can delete it. Delete options not showed when you don’t have pending release.
Or if you just simply ignore pending release, you can use new build. Go to pubspec.yaml and set this:
version: 1.4.17+67
That’s for example if you have version: 1.4.17+66 before.
If you get this error for your Flutter App's Android APK, in your app/build.gradle file under defaultConfig {}
comment out
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
and add
versionCode 2
versionName "2"
or "previous version code" + 1.
I received the same error while uploading a flutter app to playstore simply change the version code in pubspec.yaml worked for me. may be try changing the version code e.g from +1 to +2 and then rebuild the apk using
flutter build apk --split-per-abi
and upload all the apk's to the playstore for your users.
Next time when you want to push an update make sure to update the version code to +3 and so on.
Note: that the version code and version name are different you can see
that in android/local.properties file.
e.g version: 1.0.0+2
version is 1.0.0 and verison code is +2
just change the version code in yaml file.
version: 1.0.0+2 --> 1.0.0+3
This seems because you have already uploaded APK file of version 3 to Google Play Store. And again you are uploading apk with same version. So this issue has been occurred.
So for solution you need to change your version name and version code (increment with 1)and run application once and after export it upload to Google Play.
I kept getting same error again and again, Finally I uploaded the apk file manually using Google Play Console as shown in screen shot. Under App Release, You select the button "CREATE RELEASE" shown in the screen shot and upload your apk file from /android/app/bin/build/outputs/apk/release/app-release.apk
In my case I had something like this in my AndroidManifest,
javaCompileOptions {
annotationProcessorOptions {
arguments = [
'androidManifestFile': 'app\\build\\intermediates\\merged_manifests\\debug\\processDebugManifest\\merged\\AndroidManifest.xml'
]
}
}
here the 'androidManifestFile' location is wrong, changed it to
"androidManifestFile": "$projectDir/src/main/AndroidManifest.xml".toString()
everything worked
In my app/build.gradle file , version code was like this:-
In place of versionCode flutterVersionCode.toInteger() , i replaced it with as
versionCode 2
For flutter and bitbucket pipelines.
You could use the command flutter build apk --release --build-number=YOURVARNUMBER
--build-number=4 lets you assign the build number 4 when you compile apk file.
This can be used to increment the number in a pipeline build. For instance if you use some kind of continues integration pipeline. Like bitbucket pipelines, you can write
flutter build apk --release --build-number=$BITBUCKET_BUILD_NUMBER this way each build will automatically have an incremented number, rather then you having you write this number yourselfe.