/vagrant-ionic-1

Ionic developer box

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Ionic Developer Box

This box contains:

  • CentOS v7 base image
  • JDK 8
  • ionic
  • cordova
  • Android SDK
  • Zsh shell
  • Tmux
  • vim + plugins

Table of contents

How to build

Easy way

vagrant init dpalomar/ionic; vagrant up --provider virtualbox

Custom

Requirements:

  • VirtualBox
  • Git
  • Vagrant
  • vagrant-vbguest: vagrant plugin install vagrant-vbguest
  • vagrant-hostmanager: vagrant plugin install vagrant-hostmanager
  1. git clone https://github.com/dpalomar/vagrant-ionic.git
  2. cd vagrant-ionic
  3. modify/add whatever you like
  4. vagrant up
  5. vagrant ssh
  6. cd /ionic-projects
  7. ionic help

How to update android tools.

            android update sdk --no-ui --all --filter build-tools-25.0.1,android-25,extra-android-m2repository

How to attach a device.

Please, please please, before to continue. First: Is your android in developer mode? Have your device the adb debug mode enabled?

The image is built with a generic usb device for Google devices and it is possible that this not works for you. In this case you can configure your own device like that:

            vb.customize ["usbfilter", "add", "0", "--target", :id, "--name", "android", "--vendorid", "0x18d1"]

Change the --name of yours and the --vendorid for your device id. You can find a list of ids in this link: https://developer.android.com/studio/run/device.html#VendorIds

TIP: If you image is already running, execute vagrant reload

How to solve "Not permissions" issue

If you experienced the not permissions issue when run the adb devices command you must run the command with sudo:

  1. Stop the adb server sudo adb kill-server
    1. If this not works for you, you can use sudo killall adb
      1. If your system is not capable to find the killall commmand, install psmisc first sudo yum install -y psmisc
  2. Unplug your device.
  3. Plug your device again
  4. Start the adb server with sudo adb devices

TIP: If this workflow didn't work for you, you can follow this guide for a more advanced configuration http://ptspts.blogspot.com.es/2011/10/how-to-fix-adb-no-permissions-error-on.html

How to resolve the adb command not found when use sudo.

Use this: sudo ./android-sdk-linux/platform-tools/adb <command>

How to resolve the adb unauthorized issue

Check the display of you device and accept the alert of grant permissions to linked PC.

Can't build a project in windows

If you are using a windows system maybe you have experienced a fail when run ionic start <project> <template>. This occurs because windows has a limit of length in shared folders and because can't use symbolic links, and npm do that. The solutions has 2 parts:

  1. Run vagrant upwith administrator rights
    1. Run vagrant halt and close your terminal.
    2. Open a new terminal with administrator rights and run vagrant up again.
  2. Need change the node_modules folder to live in the virtual machine an not in the shared folder.
    1. Run mkdir ~/node_modules
    2. Run mkdir -p /ionic-projects/<your-project>/node_modules (If you have a previous project simply remove the node_modules folder and re-create again).
    3. Run sudo mount --bind ~/node_modules /ionic-projects/<your-project>/node_modules
  3. cd /ionic-projects/ and run ionic start <your-project> <template>
    1. If you are re-building a previous project ionic will ask you to rewrite the project. Answer yes.
  4. Also you can run npm install inside the project folder.

FAQ

  • After ionic serve, the browser is not automatic launched.

Open your browser manually and navigate to http://localhost:8100

  • My plugged device is not listed.

Please follow this guide: Step 1 and next steps.

  • I'd like to use Geanymotion emulator on my host.

Please follow this link: https://github.com/driftyco/ionic-box/issues/17#issuecomment-57971827