Introduction
In this guide, you will learn how to build and publish your project. There are multiple ways to publish your app. Some are free, but some will cost money. If you want to build a release version of your application, you will need to sign your application. If your are building for android, you will need to upload your keystore to Mobi Builder, which will compile your application using that keystore. If you are building for iOS, you don't need to upload your keystore to Mobi Builder because Mobi Builder will generate a cordova project for you which you can convert into an iOS application and sign yourself, with the help of this tutorial. If you want to build a debug application for android, you will not need to provide any keystore certificates. You can't upload a debug android application to google play or another app store market place, as they will only accept release applications.
Read how Mobi Builder protects your keystores.
Android signing
For android, you will need to generate a keystore file. You will need to have the java keytool generator (to get this you will need to download java). Next, open a command window, in windows, and type the following command:
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
You will be prompted to enter in further details. Keep a note of these details as some of them you will need later. Afterwards, a keystore certificate will be generated which you can upload to Mobi Builder to build your application.
iOS signing
For iOS devices, you will need to generate a certificate and a provisioning profile. To generate a provisioning profile go to your apple developer account (there is a fee to register a apple developer account) and make sure that you are signed in. Click 'Certificates, Identifiers & Profiles' and then click on the 'Profiles' section. Choose 'app store' under the distribution header. Next click 'continue' at the top. Choose a app, which will associate with this provisioning profile. Click 'continue' again. Choose the distrubution certificate that this provisioning profile will be linked too and click 'continue'. You can now download your provisioning profile file.
To create an Apple certificate, you will need a Mac computer and an apple developer account. Firstly, open 'Keychain access' on your Mac and in the toolbar open Keychain access > certificate assistant > Request a Certificate From a Certificate Authority. Enter in all the required information, such as the email address and common name (this should be the name of the developer as it appears in your apple developer account) that you used to register in the iOS developer program. Leave the CA email blank and make sure that 'save to disk' is selected. Click continue and choose a file name and location on your hard drive. Click save. This will create and save a certSigningRequest file (CSR) file to your hard drive. A public and private key will also be created in Keychain Access with the Common Name you entered earlier. Next, create the .cer file in your iOS developer account. You can do this by logging on to your apple developer account and then clicking on "Certificates, IDs & Profiles". Next, click the '+' button and choose “iOS Distribution (App Store and Ad Hoc)", then click "continue". Upload the CSR file that you just created and press "continue". Then, press "download".
Now we need to install the '.cer' file and generate a '.p12' file. Find the '.cer' file that you have just downloaded and double click on it. If the certificate hasn't already been installed, make sure that the dropdown is set to 'login', then click 'add'. Open up keychain access and find the two profiles that you created earlier. Now, expand the 'private key' profile. This should show you the certificate that you have just added. Select only these two items (not the public key) and then right click and click 'Export 2 items...' from the dropdown. In the next window, choose the file name for your p12 certificate file. Make sure that the file extension is '.p12' and that the file format is 'personal information exchange (.p12)'. Click 'save' and then you will be prompted to set a password.
Building your project
In the Mobi Builder editor, click 'build' at the top of your screen. Fill in all of the information about your app on the build configuration tab and the signing tab. Next, click 'build' and then wait while Mobi Builder compiles your application.
If you are building for android, Mobi Builder will compile an APK file (android package). You can then open this file on an android device or emulator to start the installation process. The installation process is quick and simple. You will be shown the permissions of the application and asked to accept them, then the app will be installed.
iOS
If you are building for iOS, Mobi Builder will generate a cordova project for you. The following steps will show you how to convert a cordova project into a iOS application. You will need to perform these steps on a mac computer.
1. Download the Node JS installer for macOS from https://nodejs.org/en/download/ and then complete the installation process.
2. Launch the macOS command line and type node-v to check that Node JS is installed.
3. Type npm install -g cordova and then go to the directory where you downloaded the cordova project.
4. Download the xcode command line tool. This is a .dmg
file.
5. When the donwload is complete, double click the .dmg
file to open it. Double click the box and then follow the on screen instructions to install the command line tool.
6. Type cordova compile ios to build your application. You will then be told the path where the outputted file is. If you want to build a signed version of your application, type cordova compile ios ----codeSignIdentity="iPhone Developer" --developmentTeam="your apple team ID" --packageType="app-store" --provisioningProfile="GUID of the provisioning profile" instead.
For more information on iOS signing in your cordova project, we recommend that you read the cordova documentation on this topic.
Choose the app store which you wish to publish your app on: