I followed Ionic Box instructions here
https://github.com/driftyco/ionic-box
add platform and build android all work fine. But this doesn’t work
$ ionic emulate android
It was asking me to do this:
android create avd --name <name> --target <targetID>
Then I found out my target list:
vagrant@ionic-android:~/myapp$ android list targets
Available Android targets:
----------
id: 1 or "android-19"
Name: Android 4.4.2
Type: Platform
API level: 19
Revision: 3
Skins: WQVGA432, HVGA, QVGA, WXGA800, WQVGA400, WXGA800-7in, WVGA800 (default), WSVGA, WVGA854, WXGA720
Tag/ABIs : no ABIs.
I tried this next:
vagrant@ionic-android:~/myapp$ android create avd --name myapp --target 1
Valid ABIs: no ABIs.
Error: This platform has more than one ABI. Please specify one using --abi.
I realized it’s error because no ABI installed. I tried to start Android SDK but error too:
vagrant@ionic-android:~/myapp$ android sdk
Exception in thread "main" org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source)
at org.eclipse.swt.widgets.Display.create(Unknown Source)
at org.eclipse.swt.graphics.Device.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
at org.eclipse.swt.widgets.Display.getDefault(Unknown Source)
at org.eclipse.swt.widgets.Shell.<init>(Unknown Source)
at org.eclipse.swt.widgets.Shell.<init>(Unknown Source)
at com.android.sdkuilib.internal.repository.ui.SdkUpdaterWindowImpl2.createShell(SdkUpdaterWindowImpl2.java:168)
at com.android.sdkuilib.internal.repository.ui.SdkUpdaterWindowImpl2.open(SdkUpdaterWindowImpl2.java:137)
at com.android.sdkuilib.repository.SdkUpdaterWindow.open(SdkUpdaterWindow.java:111)
at com.android.sdkmanager.Main.showSdkManagerWindow(Main.java:412)
at com.android.sdkmanager.Main.doAction(Main.java:376)
at com.android.sdkmanager.Main.run(Main.java:150)
at com.android.sdkmanager.Main.main(Main.java:116)
This is where I got stuck because I am not familiar with Android and don’t have a physical device to test. So my questions:
-
How to install ABI in Ionic Vigrant?
-
Then how to start the android emulator?
Thanks.
I second this question!
I am also a Windows users who is a little confused as to what to do next.
Windows users who are using the Vagrant setup, you’ll have to set up a X Windows server in addition to the setup for Vagrant. For that download Xming X Windows Server for Windows. After installing and running you’ll need to configure Putty to forward X11 messages. I found these instructions useful.
Hope this helps.
ADDITIONAL: I’ll leave this here in case someone else had a similar problem. From the android sdk interface, I tried to install the parts it needed and update everything. I continuously received the message
URL not found: /home/vagrant/android-sdk-linux/temp/android-20_r01.zip (Permission denied)
To fix I rmdir the /temp directory and reran. After that it installed just fine.
I went through the process below. I hope it helps.
Getting the Right Packages
$ android list targets
Write down the Target ID number. In this example we’ll say it is “1”.
Write down the API Level number. In this example we’ll say it is “19”
$ android list sdk --all
A list of package numbers followed by the description appears.
You are looking for the appropriate system image. So scan the list for a same-line match to the following:
- The words “System Image”.
- Your target’s API Level number (“19” in this example)
- Your computer’s CPU. I know mine’s an Intel.
I found the following match:
64 - Intel x86 Atom System Image, Android API 19, revision 2
Write down the Package Number (here, it is “64”)
$ sudo rmdir /home/vagrant/android-sdk-linux/temp
Yes, an existing temp folder seems to stop progress. The ‘sudo’ gives you root permission to delete files and folders.
Next we get our proper SDK, using the Package Number. (“64”)
And then create an AVD using our Target ID number from the very beginning. (“1”)
$ sudo /home/vagrant/android-sdk-linux/tools/android update sdk -a -u -t 64
$ android create avd --name myAvd19 --target 1
$ export ANDROID_HOME=/home/vagrant/android-sdk-linux
$ ionic build android
$ ionic emulate android
Get back: “SDL init failure, reason is: No available video device”
Emulation and X11
-
Install xming (Xming X Server for Windows download | SourceForge.net)
-
Install putty (http://www.putty.org/) (Putty should be standard part of your tool-belt.)
3, Configure Putty to both a) do a ssh connect to vagrant and b) enable X11 forwarding:
Session >
'HostName': 127.0.0.1
'Port': 2222
'Name': ionic vagrant
Connection > SSH > X11
'Enable X11 forwarding' is checked as true.
-
Save Putty session and open ssh terminal to vagrant
Session > ‘Save’
Session > ‘Open’
-
When you run ‘ionic emulate android’ it will seem like nothing’s working for a while, but the emulation should appear.
So I am doing all of this on Macbook. That’s why I got lost in the “Emulation and X11” part.
Is there an instruction for Mac on it?
This is a lot more difficult than I thought. Assume it is the X11 server that I need. I found XQuartz and installed it
http://xquartz.macosforge.org/landing/
I could not confirm if X11 server was running or how to connect to it. The Terminal ssh option does not have X11 in it:
Then I found this page on troubleshooting:
http://xquartz.macosforge.org/trac/wiki/X11-UsersFAQ
When I did this, the result was :0
as below so I guess something overriding launchd's $DISPLAY
that I have no idea how to fix:
$ echo $DISPLAY
/tmp/launch-NRxzSR/org.macosforge.xquartz:0
That’s as far as I can go. Any luck getting this vagrant ionic running on Mac, please ping me.