Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publishing a bare-workflow expo React-Native app to Google Play which was previously published in the managed workflow

My app was previously built while in the expo managed workflow. I did this using expo ba. Because android apps require that you release your app before you can add in-app-purchases, I uploaded this apk and released a beta using it.

I needed to switch to the bare workflow in order to implement in-app-purchases. Now, when trying to create a build to release the actual app, I am following the React Native instructions but must create another upload key in order to create a build(which is an aab this time).

On the play console it states

Upload key: The key you use to sign your first release. Sign every subsequent release with the same key to verify it’s from you. Keep your upload key safe. If it’s ever lost or compromised, contact developer support to replace it.

I'm pretty sure this is a problem because I used whatever expo was giving me to sign the original apk. I also cannot delete my original app and create a new app with the same bundle name because once an app is released it cannot be deleted.

like image 523
Sam Avatar asked Mar 03 '23 14:03

Sam


1 Answers

To get the previously used keystore file run

expo fetch:android:keystore

Which will display something like

Keystore credentials
  Keystore password: MYAPP_UPLOAD_STORE_PASSWORD
  Key alias:         MYAPP_UPLOAD_KEY_ALIAS
  Key password:      MYAPP_UPLOAD_KEY_PASSWORD

  Path to Keystore:  /Path/To/my_upload_store_file.jks

Edit the file android/app/build.gradle to include the information above

...
android {
    ...
    defaultConfig { ... }
    signingConfigs {
        release {
            //if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file("MYAPP_UPLOAD_STORE_FILE")
                storePassword "MYAPP_UPLOAD_STORE_PASSWORD"
                keyAlias "MYAPP_UPLOAD_KEY_ALIAS"
                keyPassword "MYAPP_UPLOAD_KEY_PASSWORD"
            //}
        }
    }
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}
...

Place my_upload_store_file.jks inside android/app

Edit the file ~/.gradle/gradle.properties or android/gradle.properties, and add the following

MYAPP_UPLOAD_STORE_FILE="my_upload_store_file.jks"
MYAPP_UPLOAD_KEY_ALIAS="MYAPP_UPLOAD_KEY_ALIAS"
MYAPP_UPLOAD_STORE_PASSWORD="MYAPP_UPLOAD_STORE_PASSWORD"
MYAPP_UPLOAD_KEY_PASSWORD="MYAPP_UPLOAD_KEY_PASSWORD"

Run the following in a terminal from the directory android

./gradlew bundleRelease

This will produce a file called app-release.aab inside the directory android/app/build/outputs/bundle/release/. Upload this file to the Google Playstore console

like image 101
Sam Avatar answered Mar 05 '23 14:03

Sam