You are here: Home / Blog / Getting Started with Mobile Meteor

Getting Started with Mobile Meteor

Posted by Fulvio Casali at Nov 13, 2014 04:57 AM |
Filed under:
The solution to a couple of problems installing the SDKs required to run Meteor as a mobile app

Today I'm skipping ahead to the Running your app on Android or iOS page of the Meteor tutorial.  The vast bulk of time required to perform these steps is taken up by downloading the various SDKs that are needed.  For this reason, I limited myself to just the Android version, and left the iOS version for another day.  Other than that, a couple of very simple commands are all it takes to get our simple-todo Meteor app to run either in an emulator, or directly on a mobile device.  And you are not limited to your local server, either - your mobile device app can immediately start talking to the remote server deployed on page 6 of the tutorial.  It is quite exhilarating to see your fully functional mobile app launched so quickly!

I encountered a couple of gotchas while running the add-platform android and the run android commands, due to environment variables not being set properly during the installation of the SDKs.  My platform is OS X Yosemite (10.10), and the Java environment I installed is the SE Development Kit 8 (jdk-8u-25).  This page automatically opened up when I ran the meteor install-sdk android command, and it contained the installation instructions.  I was also prompted to install the HAXM emulator acceleration, which I did.

> meteor add-platform android
...
Error: ERROR : executing command 'ant', make sure you have ant installed and added to your path. 

I located ant in /Users/yourname/.meteor/android_bundle/apache-ant-1.9.4, however setting the ANT_HOME variable was not sufficient.  The JAVA_HOME environment variable also needed fixing:

> ant
Error: JAVA_HOME is not defined correctly.
We cannot execute /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/bin/java

The Solution

Some googling led me to the solution, which is to set the following two environment variables:

export ANT_HOME=/Users/yourname/.meteor/android_bundle/apache-ant-1.9.4
export JAVA_HOME=$(/usr/libexec/java_home)

After this, I could run ant properly:

 

> ant
Buildfile: build.xml does not exist!
Build failed

This spells success!

With that, all the commands for mobile apps run, and I could enjoy the tutorial app on my Android phone.

 

 

Filed under: