1. React Native tutorial

Create a shareable APK for android in react Native

Steps to create an APK (signed and unsigned) which you can install on a device using CLI and share as well:

Problem statement: I’ve built my app, I can run it on my local emulator (and also on my android device by.changing debug server). But, I want to build an apk that I can send to someone without access to development server and I want them to be able to test application.

Create a key to sign the APK

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

Use a password when prompted

Once the key is generated, use it to generate
the installable build:

react-native bundle --platform android --dev false --entry-file index.android.js 
--bundle-output android/app/src/main/assets/index.android.bundle
--assets-dest android/app/src/main/res/

Generate the build using gradle

cd android && ./gradlew assembleRelease

Upload or share the generated APK

Upload the APK to your phone. The -r flag will replace the existing app (if it exists)

adb install -r ./app/build/outputs/apk/app-release-unsigned.apk

The shareable signed APK is located at:

./app/build/outputs/apk/app-release.apk

If you like this post, don’t forget to share 🙂

This article is written by our awesome writer
Comments to: Create a shareable APK for android in react Native

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

New Dark Mode Is Here

Sign In to access the new Dark Mode reading option.

Join our Newsletter

Get our monthly recap with the latest news, articles and resources.

By subscribing you agree to our Privacy Policy.

Latest Articles

Explore Tutorials By Categories

About

Codeverb is simply an all in one interactive learning portal, we regularly add new topics and keep improving the existing ones, if you have any suggestions, questions, bugs issue or any other queries you can simply reach us via the contact page

Login

Welcome to Codeverb

Ready to learn something new?
Join Codeverb!

Read Smart, Save Time
  •  
    Strength indicator
  •  
  •  
    Log In | Lost Password