A Plugin for Signing Android Builds on Expo Prebuild
Effortlessly configure signing for Android builds in Expo projects during the prebuild process.
- Step 1: Updates the
gradle.propertiesfile to include signing configurations. - Step 2: Modifies the
build.gradlefile to switch from debug signing to release signing. - Step 3: Adds a
releasesigning block to thebuild.gradlefile if it doesn’t already exist. - Step 4: Copies the keystore file to the
android > appdirectory for signing during the build process.
- Expo Local App Production Guide
- Continuous Native Generation in Expo
- React Native Documentation: Generating an Upload Key
- Automatic Configuration: Updates
android > gradle.propertiesto include the specified signing properties if they don’t already exist. - Signing Configuration: Replaces
signingConfig signingConfigs.debugwithsigningConfig signingConfigs.releaseunderandroid.buildTypes.releaseinandroid > app > build.gradle. - Release Block Addition: Adds the
releaseblock with the specified properties toandroid.signingConfigsinandroid > app > build.gradleif it doesn’t exist. - Keystore File Handling: Copies the specified
.keystorefile (defined bystore_file.value) from thekeystorePathto theandroid > appfolder.
Before using expo-signed, generate a private signing key and follow these steps:
-
Generate a Key:
Usekeytoolto create a private signing key. Follow the instructions provided in the React Native documentation on signed APKs. -
Place the Keystore File:
Add the generated keystore file to your project directory.
To install and configure the plugin:
Run the following command to install the plugin in your Expo project:
npx expo install expo-signed- Place the
.keystorefile in your project, and set the folder path (keystorePath) and file name (store_file.value) in the configuration.
Add the plugin configuration to your app.json as follows:
"plugins": [
...
[
"expo-signed",
{
"store_file": {
"key": "MY_UPLOAD_STORE_FILE",
"value": "my-upload-key.keystore"
},
"key_alias": {
"key": "MY_UPLOAD_KEY_ALIAS",
"value": "my-key-alias"
},
"store_password": {
"key": "MY_UPLOAD_STORE_PASSWORD",
"value": "************"
},
"key_password": {
"key": "MY_UPLOAD_KEY_PASSWORD",
"value": "************"
},
"keystorePath": "./src/assets"
}
],
...
]By following the above steps, you’ll be able to sign your Android builds seamlessly with expo-signed.