After releasing an initial version of my app on Google Play, I made a minor update and needed to release a new version of the app. I made the necessary changes and updated my app’s version in AndroidManifest.xml from 1.0.0 to 1.0.1 since the update was a very minor update. I then tried re-submitting my APK file to Google Play and I kept getting an “upload failed” message. What made this issue quite frustrating was that there was no other message other than the APK upload failed message. I knew my AndroidManifest.xml file was correct since all I did was change my app version. It looked like so:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.corntail.main" android:versionCode="1" android:versionName="1.0.1" >
However, the APK upload always failed. Here is a screenshot of the error I was getting on FireFox:
After several frustrating minutes of trying on FireFox, I tried uploading the same APK file on Google Chrome. I got the same error, but this time, with a more helpful message. The message said:
You need to use a different version code for your APK because you already have one with version code 1
Here is a screenshot of the upload in Chrome:
So, it turns out that, its not enough to modify your versionName in Android you also have to modify your versionCode everytime that you publish a new version of your application on Android. So here are the things to keep in mind when updating your app on Google Play:
- Change your Version code by incrementing the current value by 1. So if the current value is 1, change the value to 2
- Change your App Version Name to something bigger. If your previous version was 1.0.0, then change it to 1.1 or 1.0.1 or whatever you like (it’s always a better option to have a consistent version naming strategy).
That’s how I resolved the issue with my uploaded APK files failing. As a side note, when updating your app, never change the project package name! The Android system uses the package name as a unique identifier for your app. For Android, a different package name corresponds to a different app! If you change your package name, Google Play will treat it like a new app and you won’t be able to update it through Google Play…