2

I have an app on google play store. Currently there's only one upload.

And I want to upload a new version, but when ever I do that this error shows:

Upload failed You need to use a different version code for your APK because you already have one with version code 1

No matter weather it is versioncode 1, 2 or 3. The first release way versioncode 1, and this is versioncode 2.

I don't know what the problem is, maybe I have to sync the build.gradle, I've heard some ppl talk about that, but I am not 100% sure how to?

Also If I make a new 'App' and upload it there this error doesn't show op, that's probably because on that 'app' there's no other app-release with that name, or any with higher.

Also, there's like 300 different build.gradle files, the one I am talking about is the one under the directory

ApplicatioName\myApplication\build.gradle 

Here is the build.gradle:

defaultConfig { applicationId "com.example.myapplication" minSdkVersion 16 targetSdkVersion 30 versionCode 2 versionName "2.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } 

What do I do?

6
  • Very naïve of me to ask, but sometimes the simplest things are the culprits: Did you recreate the APK after you changed the version code? Commented Aug 17, 2020 at 19:07
  • "ApplicatioName\myApplication\build.gradle" Typically the build.gradle where you modify this setting would be in a subdirectory named app. Commented Aug 17, 2020 at 19:11
  • what was versionName on versionCode 1 ? Commented Aug 17, 2020 at 19:17
  • @lucidbrot Yea I did do that a lot :) Commented Aug 18, 2020 at 13:36
  • @Michael oh, yea I just opened that file, I do not find 'versionName'/'versionCode'. Bu there's something called FlutterVersionName = '2.0' And FlutterVersionCode = '4'. Do I change those, or and if so, why is the versioncode 4, and versionname 2 by default? Commented Aug 18, 2020 at 13:40

1 Answer 1

4

In Flutter, at least in my experience, you don't need to modify version codes anywhere but in pubspec.yaml. Say your version tag there is version: 1.0.0+1, your android version code will be 1 and your user visible version name is 1.0.0. You can change this to version: 1.1.0+2, for example, and that should fix your problem.

Edit: And, obviously, rebuild.

Sign up to request clarification or add additional context in comments.

1 Comment

Thx a whole lot, it worked :) It was that simple, yet I had never heard of it before, somehow none of my thousands of google searches had answered this, and it was just what I needed :) Thx

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.