This tutorial will describe how you can run and test the app on your own computer (Mac only, sorry ๐)
- (1) Prerequisites
- (1.1) Installing Xcode
- (1.2) Installing homebrew
- (1.3) Installing npm
- (1.4) Installing Apache Cordova
- (1.5) Installing git
- (2) Cloning the app code
- (3) Emulating the app on iOS
- (4) Emulating the app on Android
In order to emulate the app, you will need to install all of the following on your Mac:
-
Xcode - Apple's integrated development environment for Mac
-
homebrew - an excellent package manager for Mac OS, will be used to install npm
-
npm - node package manager - will be used for the installation of other components
-
Apache Cordova - a platform with a command line tool for building HTML/JS/CSS apps for mobile devices
-
git - a source control system that allows you to collaborate on this project
Keep in mind that Xcode takes ~5GB of your hard drive's space. Go to Apple's app store and install Xcode (use this link).
After the installation is completed, open the Xcode app to simply accept the license agreement.
After accepting the license agreement, there's only one step you need to take:
- Open your terminal (CMD + T and type
terminal
) - Paste the following command and hit ENTER:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Type in your password when prompted to, and that's it.
Open your terminal (CMD + T and type
terminal
).First let's check if you already have homebrew installed on your Mac:
Within the terminal, paste the following command:
brew ls -l
If the output is something along the lines of
command not found: brew
, then you should carry on as mentioned below.Within the terminal, paste the following command and follow the instructions.
You might be prompted to insert your password (it's the same password you use to log into your Mac).
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Hit enter and follow the instructions.
Open your terminal (CMD + T and type
terminal
+ ENTER), then just type the following command and press ENTER.brew update
Then run the following command and press ENTER.
You might be prompted to insert your password (it's the same password you use to log into your Mac).
brew install node
Open your terminal (CMD + T and type
terminal
+ ENTER), then just type the following command and press ENTER:You will be prompted to insert your password (it's the same password you use to log into your Mac).
sudo npm install -g cordova
Open your terminal (CMD + T and type
terminal
+ ENTER), then just type the following command and press ENTER:brew install git
- Open your terminal (CMD + T and type
Now that you have installed all of the required package managers and the required software, you can clone the app.
Open your terminal and browse to a folder where you would like to download the app.
For instance, if you would like to create a folder for projects workspace named workspace
, use the mkdir
command to create a folder and cd
command to change the folder you are currently in:
# here we are creating a new folder under the home folder:
mkdir ~/workspace
# now we are switching the working directory to it:
cd ~/workspace
Next, let's use the newly installed git tool to clone the app from this repository:
git clone https://github.com/yuvalherziger/jrp-team-1-app.git
After the numbers finish crunching, you will have a new folder named jrp-team-1-app in place. Let's go ahead and change the working directory to the root app directory:
cd jrp-team-1-app
Now for the fun part ๐
While in the jrp-team-1-app working directory, type the following command:
cordova platforms add ios
cordova build ios
This command just built an ios app that's ready to be emulated. Lastly, let's run the app on the emulator:
cordova emulate ios
Since emulating an Android device...
- requires a long setup that entails the installation of Android Studio and an AVD (Android Virtual Device);
- tends to be slow;
...I would strongly advise you to enable USB debugging on an Android device (provided that you posses one) and test the app on it. Under this link you can discover how to enable USB debugging on your Android device.
Next, you will need to make sure that
After enabling USB debugging on your Android device and connecting it to your computer with a USB cable, you can simply run the following command to build the app:
cordova platforms add android
cordova build android
Afterwards you should be able to run the app on your device by running the following command:
cordova run android
Cordova should automatically detect your connected device and target the app to it.
It just might be that you don't have an Android device, and in this case you can visit this link to find out how to create an Android Emulator.
Do mind the fact that you already have git
and homebrew
installed on your Mac from the previous steps of this guide.
If you have gone down the path of installing an Android emulator, the command to emulate it is the following one:
cordova emulate android