Steps to generate signed apk in React Native.
Step 1 Generate a Signed Release Key file
keytool -genkey -v -keystore sample.keystore -alias sample -keyalg RSA -keysize 2048 -validity 10000
(Here, keytool is the utility tool. -genkey & -keystore are the attributes, sample.keystore is the filename (here the file name is sample, you can change), RSA algorithm is used, and the keysize is 2048, the validity is 10000 days. )
Enter your password .... (password is min 6 characters. note down and keep it safe)
Enter other details....
It will create the file sample.keystore in the project root. Copy the file and paste it in the android/app folder.
Step 2 Setting up Gradle variables
filepath - android/gradle.properties
MYAPP_RELEASE_STORE_FILE=sample.keystore
MYAPP_RELEASE_KEY_ALIAS=sample
MYAPP_RELEASE_STORE_PASSWORD=sample*123#
MYAPP_RELEASE_KEY_PASSWORD=sample*123#
Step 3 Adding signing config to app's Gradle config
filepath - android/app/build.gradle
after the defaultConfig {} section
signingConfigs
{
release
{
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE'))
{
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
buildTypes
{
release
{
...
.....
signingConfig signingConfigs.release
}
}
Step 4 Generating the APK (takes 5-10 minutes)
projname\android> gradlew assembleRelease
Source : https://www.youtube.com/watch?v=Wvy8ACbP38I
Comments
Post a Comment