This box contains:
- CentOS v7 base image
- JDK 8
- ionic
- cordova
- Android SDK
- Zsh shell
- Tmux
- vim + plugins
vagrant init dpalomar/ionic; vagrant up --provider virtualbox
Requirements:
- VirtualBox
- Git
- Vagrant
- vagrant-vbguest:
vagrant plugin install vagrant-vbguest
- vagrant-hostmanager:
vagrant plugin install vagrant-hostmanager
git clone https://github.com/dpalomar/vagrant-ionic.git
cd vagrant-ionic
- modify/add whatever you like
vagrant up
vagrant ssh
cd /ionic-projects
ionic help
android update sdk --no-ui --all --filter build-tools-25.0.1,android-25,extra-android-m2repository
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
If you experienced the not permissions issue when run the adb devices
command you must run the command with sudo:
- Stop the adb server
sudo adb kill-server
- If this not works for you, you can use
sudo killall adb
- If your system is not capable to find the killall commmand, install psmisc first
sudo yum install -y psmisc
- If your system is not capable to find the killall commmand, install psmisc first
- If this not works for you, you can use
- Unplug your device.
- Plug your device again
- 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
Use this: sudo ./android-sdk-linux/platform-tools/adb <command>
Check the display of you device and accept the alert of grant permissions to linked PC.
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:
- Run
vagrant up
with administrator rights- Run
vagrant halt
and close your terminal. - Open a new terminal with administrator rights and run
vagrant up
again.
- Run
- Need change the node_modules folder to live in the virtual machine an not in the shared folder.
- Run
mkdir ~/node_modules
- 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). - Run
sudo mount --bind ~/node_modules /ionic-projects/<your-project>/node_modules
- Run
cd /ionic-projects/
and runionic start <your-project> <template>
- If you are re-building a previous project ionic will ask you to rewrite the project. Answer yes.
- Also you can run
npm install
inside the project folder.
- 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