Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native android build version code not updating

I have edited the versionCode in both the android\app\build.gradle file :

versionCode 2
versionName "2.0"

and I have updated the AndroidManifest.xml file

package="com.reactnativeapp"
android:versionCode="2"
android:versionName="2.0"

BUT I still get this error when I try to release an update to my app on google play store!

You need to use a different version code for your APK or Android App Bundle 
because you already have one with version code 1.

I have tried running

gradlew clean 

in the android folder and rebuilding the project and nothing has worked. Does anyone have any ideas?

like image 827
peter Avatar asked Nov 07 '22 05:11

peter


1 Answers

Make sure that you have your versionCode and versionName set inside defaultConfig like this:

android {
    ...
    defaultConfig {
        versionCode = 2
        versionName = "2.0"
    }
    ...
}

You might have it set up for a debug-only config, which wouldn't change for release builds.

like image 54
Noah Allen Avatar answered Nov 14 '22 21:11

Noah Allen