How to run Ionic framework with Genymotion on Ubuntu?

How to run Ionic framework with Genymotion on Ubuntu?

This instructions are for Ubuntu 16.04 LTS.

installations:

You need java for running android! 1) sudo apt-get install openjdk-8-jdk 2) sudo apt-get install openjdk-8-jre

You need Android studio, first download it 1) https://developer.android.com/studio/index.html 2) Unpack the file you downloaded to an appropriate location for your applications, for example I use my home folder 3) To launch Android Studio, open a terminal, navigate to the android-studio/bin/ directory, and execute studio.sh 4) run updates and download sdk 5) download -> https://dl.google.com/android/repository/tools_r25.2.3-linux.zip 6) go to SDK folder like cd /home/test/Android/Sdk and delete tools folder 7) Copy “tools” folder from the file you downloaded to your SDK folder for example /home/test/Android/Sdk/

You need genymotion 1) First install virtualbox -> sudo apt-get install virtualbox 2) download genymotion but first you need register, personal use is free! -> https://www.genymotion.com/account/login/ 3) than go to downloads , move it your home folder and than make it executable -> chmod +x genymotion-2.8.1_x64.bin 4) run -> ./genymotion-2.2.2_x64.bin 5) after installations switch to cd /home/[username]/genymotion/ 6) run -> ./genymotion 7) add your first virtual device

8) change settings -> adb -> use custom android sdk tools and select your sdk folder

9) start the service

You need ionic 1) sudo apt-get update 2) sudo apt-get install nodejs 3) sudo apt-get install npm 4) sudo npm install -g cordova 5) sudo npm install -g ionic 6) create example project -> ionic start todo blank 7) ionic platform add android 8) desktop browser testing -> ionic serve 9) testing with genymotion -> ionic run android

Additional

  • if you have problems like “libGL error: unable to load driver: r600_dri.so , libGL error: driver pointer missing” 1) go to your genymotion folder and rename “libdrm.so.2” with “libdrm.so”

  • if you have problems like “Error: No emulator images (avds) found.” 1) it means your sdk folder is not correctly given, check it again

  • Error: adb: Command failed with exit code 1 Error output: error: could not install *smartsocket listener: Address already in use ,ADB server didn’t ACK* 1) it means it cant find genymotion , you should check genymotion setting, it must be set use custom android sdk tools!

  • Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK. 1) you should copy tools folder inside sdk folder!

  • Error: Failed to find ‘ANDROID_HOME’ environment variable. Try setting setting it manually. Failed to find ‘android’ command in your ‘PATH’. Try update your ‘PATH’ to include path to valid SDK directory. 1) vim ~/.bashrc 2) add -> export ANDROID_HOME=/home/testuser/Android/Sdk 3) export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools 4) source ~/.bashrc