Setup - MarkTime/MarkTimeJS GitHub Wiki

This page will demonstrate how to setup MarkTimeJS on a personal computer, to develop and test it.

Table of Contents

Before You Start

All commands in this guide begin with a dollar sign (`$`). This is simply to represent the prompt in the console, and shouldn't be typed.

Prerequisites

MarkTimeJS requires [Apache Cordova](https://cordova.apache.org/). For development, we use [Apache Ripple](http://ripple.incubator.apache.org/) for emulation, however, you can use the [Android Virtual Device](http://developer.android.com/tools/devices/index.html) system along with the [Cordova emulation command](http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface_test_the_app_on_an_emulator_or_device), or even run the application on your own device if you wish.

Both Cordova and Ripple Emulator require NodeJS. Before continuing, verify that this is installed correctly and available from your command line by running the following command:

$ npm version

Apache Cordova and Ripple are both available on NPM. At the time of this writing, to download and install them into Node, use the following commands:

$ npm install -g cordova
$ npm install -g ripple-emulator

Installation

Once these are installed, you will then need to clone the MarkTimeJS git repo onto your computer. If you have [Git](http://git-scm.com/) installed, you can run the following command:
$ git clone git://github.com/MarkTime/MarkTimeJS.git /path/to/folder/

This will download the Git repo into the specified folder (replace /path/to/folder/ with the folder to download into).

Otherwise, if you don't have Git, you can also download a ZIP file.

Note: Cordova and Ripple require that you are in the root directory of the MarkTimeJS application before running any commands.

Emulating

There are various ways to emulate the MarkTime application. This guide will demonstrate how to run MarkTime as an Android application, or in the Ripple Emulator. See the Cordova documentation for more information on how to run MarkTime in other emulators.

Warning! Use of the Ripple emulator is discouraged, as various parts of MarkTime may not work. For this reason, we recommend using the AVD Emulator, instead.

Using the Ripple Emulator

To run MarkTimeJS in the Ripple Emulator, first navigate to the repo folder:
$ cd /path/to/folder/

Now, use the ripple emulate command to begin emulating:

$ ripple emulate

A new browser window will open containing the emulation. If Ripple comes up with an error, first try a different browser, and then try restarting Ripple. MarkTimeJS outputs messages to the console when an activity occurs. Opening the Javascript console is different for different browsers, so check your browsers documentation for information on how to do this.

Using the AVD Emulator

The Android SDK comes with an emulator which can also be used with MarkTimeJS. The following instructions are for Windows, but should be similar on other operating systems.

To open the AVD Manager, first open a command window and navigate to the Android SDK path:

$ cd /path/to/sdk/

Now, navigate to the tools folder in this folder:

$ cd tools

To run the AVD manager, enter the following command:

$ android avd

To add a new Android Virtual Device, click on the New... button to the right. This will open a window similar to the following: Adding a new virtual device

Fill out this field with the desired options. Note that Android Virtual Devices generally need a relatively large amount of RAM and SD Card size to run (possibly 500MB or more). If the Virtual Device fails to run, try fiddling with these values.

Once you have finished filling out the field, select the OK button.

To run the new AVD, select the AVD in the list and click the Start... button to the right. If the AVD fails to start, try changing the RAM and SD Card size, and then restarting the AVD Manager.

Once the virtual device has started, navigate to the MarkTimeJS folder in the command prompt:

$ cd /path/to/folder/

Now, use the cordova emulate command to install the program onto the virtual device:

$ cordova emulate android

Cordova will now build and install the program onto the device, and then run the program.

MarkTime outputs information to the console when an activity occurs. When running an AVD, this can be accessed using Chrome by going to the following URL: chrome://inspect/#devices. Once Cordova has completed building and uploading MarkTime, the device will appear on this list. Click the inspect link to open an interactive console.

Faster Emulation on Intel

Intel have developed a system that allows you to make use of the Intel® HAXM engine, which speeds up emulation on Intel CPUs. For more information on how you can do this, check out [this page](https://software.intel.com/en-us/android/articles/speeding-up-the-android-emulator-on-intel-architecture).

Faster Emulation on AMD

While AMD does not have an engine similar to Intel, it does have an Android emulator that can be used to speed up development. By downloading AMD Appzone, you can use Cordova to emulate in the same way that you would with a normal Android device. The installer for Appzone can be found [here](http://cdn.bluestacks.com/public/bstkappsonpc/amdapps/Downloads/bluestacks_appplayer_AMD_Installer.exe), courtesy of [this article](http://www.slashgear.com/amd-appzone-player-puts-android-apps-on-apu-pcs-27249478/).

Building

MarkTimeJS can be run on your device instead of an emulator. To do this, first attach your device to the computer. The device must have the **USB debugging** option enabled. For more information, see the [Cordova platform guide](http://cordova.apache.org/docs/en/edge/guide_platforms_index.md.html#Platform%20Guides). Now, navigate to the root directory of MarkTimeJS:
$ cd /path/to/folder/

Depending on your device's operating system, you may need to add the required platform to the Cordova system:

$ cordova platform add <platform>

See the Cordova reference for more information on what plaforms are supported. Replace <platform> with the name of the platform.

You must build MarkTimeJS before uploading it to your device:

$ cordova build <platform>

Replace <platform> with the name of the platform. Cordova will now build the MarkTimeJS project. Once this has completed, run the following command to upload the program to your device:

$ cordova run <platform>
⚠️ **GitHub.com Fallback** ⚠️