Tag: reactjs

  • Tweaked steps to prevent path errors in ionic capacitor + reactJS projects

    Follow these:

    sudo chmod -R 777 . #incase sudo trapped at install time.
    ionic capacitor copy ios
    cp -r build/static ios/App/App/public/{custom-context-path-if-any}
    ionic capacitor update ios
    npx cap open ios

    On Xcode,

    • clean build folder
    • build
    • run on device or simulator
  • 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