Tag: android

  • Convert ReactJS App to Android App on Ubuntu

    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