Install Cordova
npm install cordova -g
Create a Cordova project
cordova create ReactBasedPhoneApp
Open package.json of the existing ReactJS App.
Copy the sections – scripts, dependencies, browserList from the above package.json and paste it into the ReactBasedPhoneApp/package.json
Build the existing ReactJS App
npm run build
After the build completes successfully, copy the contents inside the build folder of the existing reactJS app to ReactBasedPhoneApp/www folder
Set Android Home
export ANDROID_SDK_ROOT=/home/{username}/Android/Sdk export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Add Android plugin
cordova platform add android #in case you use phone camera in the application cordova plugin add cordova-plugin-camera
Build the APK
cordova build android #if you want to debug the app in a running simulator or USB connected android phone cordova run android
Kj [/.] Sreekumar programs computers as a hobby and profession. Into programming from his school days, Sree uses Codemarvels to key in facts and fixes he finds interesting while working on different projects. Some of the articles here give away a few shades of his philosophical leanings too.