Ionic Framework

Restore from Git

git clone yada-yada-yada
cd $project
npm install
ionic cordova prepare


Ionic 3

If using native plugins (dialogs, appversion) use:

ionic cordova run browser

Some plugins (ex. AppVersion) will not show in browser or even not in Ionic View - you have to guard them with:

if (platform.is("cordova")) {
  // Do something
}

... and test on a real device.


ionic-native/dialogs

ionic cordova plugin add cordova-plugin-dialogs
npm install --save @ionic-native/dialogs
ionic cordova platform add browser


If Android Emulator f*cks up

It happens. Delete the $HOME/.android directory and recreate the AVD.


Installation on Linux

Tested on Ubuntu 17.10.

  1. Install Android Development Studio and latest SDK
  2. Launch Studio and go through the drill of creating your first project. Download all unmet requirements.
  3. Create and launch an AVD. Publish your first starter Android project to the AVD and see that it runs.
  4. If the emulator cannot start due to libGL error: unable to load driver: i965_dri.so then do the following:
    cd Android/Sdk/emulator/lib64/libstdc++
    mkdir ORIG
    mv libstdc++* ORIG
    ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 .
  5. Install Node.js v6 LTS:
    sudo su -
    echo deb https://deb.nodesource.com/node_6.x xenial main > /etc/apt/sources.list.d/nodesource.list
    echo deb-src https://deb.nodesource.com/node_6.x xenial main >> /etc/apt/sources.list.d/nodesource.list
    curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
    apt update
    apt install nodejs
    apt install npm
  6. Make npm packages local to the user:
    mkdir ~/.npm-global
    npm config set prefix '~/.npm-global'
  7. Add necessary environment variables to your profile:
    STUDIO_HOME="/path/to/android-studio"
    JAVA_HOME="$STUDIO_HOME/jre"
    GRADLE_HOME="$STUDIO_HOME/gradle/gradle-4.1"
    ANDROID_HOME="$HOME/Android/Sdk"
    NPM_PACKAGES="$HOME/.npm-global"
    MANPATH="$NPM_PACKAGES/share/man:$MANPATH"
    PATH="$NPM_PACKAGES/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$JAVA_HOME/bin:$GRADLE_HOME/bin:$PATH"
    export JAVA_HOME ANDROID_HOME NPM_PACKAGES MANPATH PATH
  8. Install Ionic:
    npm install -g cordova ionic