Version code 1 has already been used. Try another version code

Solution 1:

you have two ways doing this, if you released your bundle already, then you have to update your version code like in Len_X's answer,

if you're still developing and pushed app bundle for say, testing, and then you delete it, this bundle is saved as a draft with that version code, so it says that you can't use the same version because it already sees another one with the same version name. you can fix that by going to release section, go to app bundle explorer, in the top right you should see a dropdown button for you app version, click on it, a bottomsheet will show containing all the previous app bundles you uploaded it. delete the one with clashing bundle version and you're good to go. hope that's your problem

Solution 2:

You can do it manually by going to "app_name/android/app/build.gradle" file. In defaultConfig section change version code to a higher number

  defaultConfig {
        applicationId "com.my.app"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 1 // Change to a higher number
        versionName "1.0.1" // Change to a higher number
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }