React Native Generate APK — Debug and Release APK

<p>An Android Package Kit (APK) is the package file format used by the Android OS for distribution and installation of mobile apps. It is similar to the .exe file you have on Windows OS, a .apk file is for android.</p> <h1>Debug APK</h1> <h2>What can I use it for?</h2> <p>A debug .apk file will allow you to install and test your app before publishing to app stores. Mind you, this is not yet ready for publishing, and there are quite a few things you&rsquo;ll need to do to before you can publish. Nevertheless, it&rsquo;ll be useful for initial distribution and testing.</p> <p>You&rsquo;ll need to enable debugging options on your phone to run this apk.</p> <h2>Prerequisite:</h2> <ul> <li>react-native version &gt; 0.58</li> </ul> <h2>How to generate one in 3 steps?</h2> <p><em>Step 1:</em>&nbsp;Go to the root of the project in the terminal and run the below command:</p> <p><code>react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res</code></p> <p><em>Step 2:</em>&nbsp;Go to android directory:</p> <p><code>cd android</code></p> <p><em>Step 3:</em>&nbsp;Now in this&nbsp;<code>android</code>&nbsp;folder, run this command</p> <p><code>./gradlew assembleDebug</code></p> <p>There! you&rsquo;ll find the apk file in the following path:<br /> <code>yourProject/android/app/build/outputs/apk/debug/app-debug.apk</code></p> <p><a href="https://medium.com/geekculture/react-native-generate-apk-debug-and-release-apk-4e9981a2ea51">Click Here</a></p>
Tags: JavaScript apk