> For the complete documentation index, see [llms.txt](https://knowlephant.gitbook.io/react-native-share-backend-app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowlephant.gitbook.io/react-native-share-backend-app/installation-serverapi-1/how-to-deploy-to-google-play.md).

# How to deploy to Google Play

Submitting your app to Google Play can be a little daunting the first time. With the below steps your app will be submitted to Google Play in no time.

### Prerequisites

In order to upload to Google Play you are required to have access to an [Android developer account](https://play.google.com/console/signup).&#x20;

Deploying your app to the Play Store takes a few days to complete and consists of the following steps:

**Step 1: Generate a signing key**

You can generate a private signing key using the following command:

`keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000`

This command prompts you for passwords for the keystore and key. Write down your password, you will need it later. It then generates the keystore as a file called my-release-key.keystore.

{% hint style="warning" %}
**Note:** On Windows keytool must be run from C:\Program Files\Java\jdkx.x.x\_x\bin
{% endhint %}

**Step 2: Add your keystore in the android/app**

Place the my-release-key.keystore file inside the android/app directory in your project folder.

Next, open the file android/gradle.properties and add the following variables (replace \*\*\*\*\* with the correct keystore password, alias and key password):

```
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=*****
MYAPP_RELEASE_KEY_PASSWORD=*****
```

**Step 3: Changing App Name**

Open *android/src/main/res/values/strings.xml* and change the *app\_name* value.

**Step 4: Change bundle identifier:**

{% hint style="warning" %}
**Note:** Skipping any of the changes below will result in errors once publishing your app to the Play Store.
{% endhint %}

Renamed your project subfolders (3 file name changes) from: "*android/app/src/main/java/com/knowlephant/share/*" to: "*android/app/src/main/java/com/YOUR\_COMPANY\_NAME/YOUR\_APP\_NAME/*"

<figure><img src="https://1546084265-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDo9SGV4WureLHZmE6W%2Fuploads%2Fbf9SNGenQqv3rv4SKsk7%2FScreenshot%202022-08-27%20at%2012.10.25.png?alt=media&amp;token=cdf0aed0-1f70-4d53-91a4-1c0ae1d01b8e" alt=""><figcaption><p>BundleIDs are often written as <br>com.YOUR_<em>COMPANY_NAME.YOUR_APP_</em>NAME</p></figcaption></figure>

Then manually switched the old and new package ids:

In: *android/app/src/main/java/MY/APP/NEW\_ID/MainActivity.java*:

```go
package MY.APP.NEW_ID;
```

In *android/app/src/main/java/MY/APP/NEW\_ID/MainApplication.java*:

```go
package MY.APP.NEW_ID;
```

In *android/app/src/main/AndroidManifest.xml*:

```ini
package="MY.APP.NEW_ID"
```

And in *android/app/build.gradle*:

```bash
applicationId "MY.APP.NEW_ID"
```

In *android/app/BUCK*:

```go
android_build_config(
  package="MY.APP.NEW_ID"
)
android_resource(
  package="MY.APP.NEW_ID"
)
```

Finally do a Gradle' cleaning in the end using the following commands in Terminal/Command line:

```bash
cd android

./gradlew clean
```

**Step 5: Generate the release APK:**

<pre><code><strong>./gradlew bundleRelease
</strong></code></pre>

The generated APK can be found in the following folder: */MobileApp/android/app/build/outputs/bundle/release/app-release.aab*.

**Step 6: Upload to Google Play Console**

Assuming you have completed the Play Store app description, images, and all other fields Play Store requires for app submissions, you can now upload your app by:

* Creating an Internal Testing track and add yourself as a tester.
* Upload your app bundle.
* Submit for internal testing.

Once you're happy with the build, you can promote your build for release to the Play Store.&#x20;
