How To Use Crosswalk in Ionic 2 or 3 To Solve Compatibility Issue in Android

To use the crosswalk in ionic app follow the below steps:


  • First, create an ionic app
  • As the crosswalk doesn't support the Cordova 3.6(latest version) so you have to install the Cordova android platform 3.5
  • To install Cordova android platform 3.5, run this command: codova platform add android@3.5
  • Then download the crosswalk and extract(Two version X86 and ARM)
  • Then navigate to your application/platform/android/cordovaLib directory
  • Then delete everything inside that directory
  • Then open the extracted crosswalk folder and navigate to the framework directory
  • Then copy all the files and paste into your application/platform/android/cordovaLib directory
  • Then open the ARM version and navigate to xwalk_core_lib/libs/ 
  • Then copy the folder which start with arm and paste into application/platform/android/cordovaLib/xwalk_core_lib/libs/ directory
  • And one last file you need to copy is the version file from xwalk_core_lib directory and have to add into application/platform/android/ directory
  • Then navigate to application/platform/android/cordovaLib/ through command line
  • Then run this command:  android update project --subprojects --path . --target "android-19"
  • Then run this command to build a debugger: ant debug
  • Then go to your android manifest file add the ACCESS_WIFI_STATE and ACCESS_NETWORK_STATE permission
  • To add this permission just add the below code to application/platform/android/AndroidManifest.xml file(add the code just before ending of the manifest tag)

    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />

  • Then go to your application root directory and build your project and check in lower version of  android and comment here if you have issues

Comments

  1. /*Use the below function to check the name using regular expression */
    /*this method will return false if the name is not a valid name*/

    function nameValidator(name) {
    var reg = /^[a-zA-Z ]{1,}([.']{0,1}?[ a-zA-Z ]{1,}|[ a-zA-Z ]{1,})([.']{0,1}?[ a-zA-Z ]{1,}|[ a-zA-Z ]{0,})$/;
    return reg.test(name);
    }

    ReplyDelete
  2. /**
    * Get Ordinal s of a particular number
    */
    function getOnlyOrdinal  {
    var s=["th","st","nd","rd"],
    v=n%100;
    return (s[(v-20)%10]||s[v]||s[0]);
    }

    ReplyDelete
  3. /**
    * Check a input key is number or not
    */
    function isNumber(evt) {
    evt = (evt) ? evt : window.event;
    var charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
    return false;
    }
    return true;
    }

    ReplyDelete
  4. /*HTACCESS FOR URL ROUTING FOR ANGULAR 2 APPLICATION*/

    RewriteEngine On
    # If an existing asset or directory is requested go to it as it is
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
    RewriteRule ^ - [L]

    # If the requested resource doesn't exist, use index.html
    RewriteRule ^ /index.html

    ReplyDelete

Post a Comment

Popular posts from this blog

Create a Background Service Using systemd In Linux

HTACCESS FOR URL ROUTING FOR ANGULAR 2 APPLICATION