This section details how to build and run the mobile application from source, for pre-built artifacts see deployment guide.
Once you have these tools set up, move to the MobileClient/ folder and run the following command to install the remaining dependencies:
npm installAny ionic application can be run on a browser for testing basic functionality. To ensure correct installation, from the MobileClient/ folder run:
ionic serveYou should be greeted by a registration page in your browser. If this command fails to run, ensure all the prerequisites have been installed correctly.
If you click scan in the registration page, you will get the following error:
Error: Uncaught (in promise): ReferenceError: 'cordova' is not defined ReferenceError: 'cordova' is not defined at Anonymous function (http://localhost:8100/build/main.js:371:13) at t.prototype.invoke (http://localhost:8100/build/polyfills.js:3:9008) at onInvoke (http://localhost:8100/build/vendor.js:30921:21) at t.prototype.invoke (http://localhost:8100/build/polyfills.js:3:9008) at e.prototype.run (http://localhost:8100/build/polyfills.js:3:6455) at Anonymous function (http://localhost:8100/build/polyfills.js:3:4574) at t.prototype.invokeTask (http://localhost:8100/build/polyfills.js:3:9614) at onInvokeTask (http://localhost:8100/build/vendor.js:30912:21) at t.prototype.invokeTask (http://localhost:8100/build/polyfills.js:3:9614) at e.prototype.runTask (http://localhost:8100/build/polyfills.js:3:7057) at s (http://localhost:8100/build/polyfills.js:3:4205) at Anonymous function (http://localhost:8100/build/polyfills.js:3:4612) at t.prototype.invokeTask (http://localhost:8100/build/polyfills.js:3:9614) at onInvokeTask (http://localhost:8100/build/vendor.js:30912:21) at t.prototype.invokeTask (http://localhost:8100/build/polyfills.js:3:9614) at e.prototype.runTask (http://localhost:8100/build/polyfills.js:3:7057) at i (http://localhost:8100/build/polyfills.js:3:3664) at invoke (http://localhost:8100/build/polyfills.js:3:10870)
If you click dismiss in the registration page, you will get the following error:
Error: Error in ./RegistrationPage class RegistrationPage - inline template:40:2 caused by: Object doesn't support property or method 'dismiss' at DebugAppView.prototype._rethrowWithContext (http://localhost:8100/build/vendor.js:89149:17) at Anonymous function (http://localhost:8100/build/vendor.js:89162:17) at Anonymous function (http://localhost:8100/build/vendor.js:35817:9) at t.prototype.invokeTask (http://localhost:8100/build/polyfills.js:3:9614) at onInvokeTask (http://localhost:8100/build/vendor.js:30912:21) at t.prototype.invokeTask (http://localhost:8100/build/polyfills.js:3:9614) at e.prototype.runTask (http://localhost:8100/build/polyfills.js:3:7057) at invoke (http://localhost:8100/build/polyfills.js:3:10827)
Those errors are expected.
If this step succeeds, you are ready to run on an emulator or device.
- JDK 8 or later and JAVA_HOME set to the right path
- Android SDK and ANDROID_HOME set to the right path
Ensure that you have the Android SDK downloaded
To download the native plugins and setup the cordova android project run:
ionic cordova platform add android@6.4.0To build application:
ionic cordova build androidTo run the application on a device or emulator:
ionic cordova run androidIn some environments, building fresh clones may fail with the errors:
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndexTo solve these issues, go to the plugin/ directory, search for "com.android.support:support-v4:+" and replace it with "com.android.support:support-v4:27.1.0". You will need to change that in two files: build.gradle and barcodescanner.gradle.
Then remove and add the Android platform directory using the commands:
ionic cordova platform remove android
ionic cordova platform add android@6.4.0For Windows, if you get errors like "Error occurred during initialization of VM. Could not reserve enough space for 2097152KB object heap", make sure your jvm is in the correct architecture. You can check your system type in System Information APP. For example, you may see x64-based PC for your system type. Then you will need to download Windows x64 Java SE Development Kit from JDK.
- XCode 7 or higher
- iOS 9
- A free Apple ID or paid Apple Developer account
To download the native plugins and setup the cordova iOS project run:
ionic cordova platform add iosTo build application:
ionic cordova build iosTo run the application on a device or emulator, you will need to set up a provisioning profile, and follow the steps outlined in the ionic documentation.