Skip to content

Running zmNinja from Source

Pliable Pixels edited this page Nov 6, 2017 · 63 revisions

NOTE If you want to run it on your desktop, you can directly download desktop binaries here and if you want it for Android/iOS you can get from the play/appstore. This is only for those who want to run from source.

Note: If you are building from source, you are mostly on your own. I have very limited time to debug environment differences/package differences between what I have and what you may have. I'm not a nodejs/grunt etc expert and stuff seems to change all the time.

Version note: The code is compiled using the following versions of tools. If you are using newer versions of ionic the code may not compile - I don't have the time to upgrade yet. Finally, if you choose to go the source route, I expect you to spend a lot of time yourself debugging first before you create an issue. Even if you do create an issue, I have very limited bandwidth to debug source compilation issues for you. Thanks.

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.16.0
    ionic (Ionic CLI) : 3.16.0

global packages:

    cordova (Cordova CLI) : 7.0.1 
    Gulp CLI              : not installed globally

local packages:

    Cordova Platforms : android 6.2.3 ios 4.4.0
    Ionic Framework   : ionic1 1.3.5

System:

    Android SDK Tools : 25.2.5
    ios-deploy        : 1.9.2 
    Node              : v8.6.0
    npm               : 5.3.0 
    OS                : macOS Sierra
    Xcode             : Xcode 9.1 Build version 9B55 

Environment Variables:

    ANDROID_HOME : /Users/pp/Library/Android/sdk/

Misc:

    backend : legacy


Install Dependencies - needed for all platforms

Install NodeJS

For Ubuntu/Linux:

sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

For other systems: Just download NodeJS and install it

Install cordova, ionic, and bower

npm install -g cordova@7.0.1 ionic bower # this installs ionic2, bower, and the version of cordova specified above

And some more:

npm install -g gulp
npm install node-sass
npm install async
npm install jshint

(Note you may need to do sudo depending on how your system is set up. It's better you don't, but if you must, well, you must)

If you get a newer version, you should adjust your cordova version to the mentioned version above in order to be able to successfully compile zmNinja. To change the version you can follow these instructions: change cordova version

Download zmNinja

git clone --depth 1 https://github.com/pliablepixels/zmNinja.git

Configure build configure zmNinja and get all required plugins

cd zmNinja
npm install
bower install
cordova prepare

You may see an error related to org.devgeeks.Canvas2ImagePlugin. To fix that:

cordova plugin add https://github.com/flache/Canvas2ImagePlugin --nofetch

Making an iOS build

Note: You need to be doing this on a mac, with Xcode and the SDK installed

To compile a debug build for iOS:

 ionic cordova platform add ios # if not added already
 ionic cordova build ios

This does not produce an iOS ready ipa. What you need to do then is to open platforms/ios/zmNinja.xcodeproj in Xcode. Then go to Project -> General, enable all these options as below and the compile and deploy on your device . Make sure you use your provisioning profiles.

Making an Android build

Note that you need the Android SDK installed and configured properly for this to work.

 ionic cordova platform add android # if not added already
 ionic cordova build android

Making a desktop build

Troubleshooting

If you're using the push plugin with a cordova version < 4.0.0 you'll get a linkage error when building zmNinja.

ld: '<file.o>' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

To get around this error, you'll have to disable bitcode for your zmNinja project as described in this stackoverflow answer: Disable bitcode in XCode

##3. Making an Android build Note: You need to have the Android SDK and build tools installed.

To compile a debug build for Android:

ionic build android

If this complains of missing SDKs, you need to install the SDK version it requests This should produce an APK file. To install it on your phone over adb, you'd do something like

adb install -r platforms/android/build/outputs/apk/android-armv7-debug.apk

##3. Running it on a desktop zmNinja can also run inside your browser as a desktop app. Note, if you are facing issues with http/https requests failing, I'd recommend you go the electron way. My desktop binaries are built using electron. Its a bit of a pain to set up but once done, you can just use my make_desktop script to keep building new versions. Instructions HERE.

Step 1: Set up the proxy redirect

edit ionic.config.json and the in the line that says

"proxyUrl": "http://server/zm",

replace server with your ZM hostname or IP. Note that if you are using SSL its important that the hostname matches the common name you used when generating the certificate. For example, if you used a common name of myserver.ddns.net and then specified its IP here, SSL would fail.

What we are doing here is telling ionic to proxy requests to ZM via a proxy server - this is needed so that SSL as well as API authentication works. Plus this is needed to avoid CORS problems in desktops

Step 2: Run with it!

Simply do a (while inside the zmNinja root directory)

ionic serve 
-or-
ionic serve -c # to display console logs in the terminal - recommended to debug and figure out what's going wrong

Enjoy.

Clone this wiki locally