Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,30 @@
title: "Use MIN With Older Studio Pro Versions"
url: /refguide/mobile/distributing-mobile-apps/use-min-older-sp/
weight: 45
description: "This guide will help you build a MIN app compatible with a non-LTS Studio Pro version."
description: "How to build your own Make It Native app for older Studio Pro versions."
---

## Introduction
## Introduction

The Make It Native (MIN) app allows you to test native apps in development with ease. We have also made it open source, allowing you to change it depending on your needs. You can continue to use the [Make It Native App](/releasenotes/mobile/make-it-native-parent/) we provide via the iOS App Store and Google Play Store, or you can build your own Make It Native app.
The Make It Native (MIN) app lets you test native apps during development. Check [Getting the Make It Native App](/refguide/mobile/getting-started-with-mobile/prerequisites/#get-min-app) for downloads compatible with your Studio Pro version. If a compatible download isn't available, you can build the open-source app yourself.

A common reason to build your own Make It Native app is to support one or more development teams that work on a specific version of Mendix and require additional native dependencies. Building your own Make It Native app is an alternative to [Creating a Custom Developer App](/howto/mobile/how-to-devapps/) which adds more convenience for your developers and gives you more control over the native app.
If you need to test app-specific native dependencies, you can also [create a custom developer app](/refguide/mobile/distributing-mobile-apps/building-native-apps/how-to-devapps/).

This guide explains how to build your own Make It Native app.
{{% alert color="warning" %}}
Mendix does not support self-built Make It Native apps for older Studio Pro versions. If you use one, you are responsible for building and maintaining it.
{{% /alert %}}

This page is kept for reference. For current build instructions and future updates, use the README for your Studio Pro release line in the open-source Make It Native repository:

* [Studio Pro 10.24 LTS](https://github.com/mendix/make-it-native/blob/mx/10.24/README.md)
* [Studio Pro 11.12 LTS](https://github.com/mendix/make-it-native/blob/mx/11.12/README.md)
* [Studio Pro 11.17 and later (`main`)](https://github.com/mendix/make-it-native/blob/main/README.md)

For another release line, look for a matching branch in the [Make It Native repository](https://github.com/mendix/make-it-native/branches/all).

### Getting Started

First things first, make sure you clone your repo:
Clone the Make It Native repository:

```bash
git clone https://github.com/mendix/make-it-native.git
Expand All @@ -24,37 +34,31 @@ cd make-it-native

#### Select Mendix Version

Next, select the Mendix version you want to build your Make It Native App for:

```bash
git checkout <BRANCH_NAME>>
```

For example, if you want to build Make It Native for Mendix 11.0.0, do the following:
Check out the branch for your Studio Pro version. For example, for the Studio Pro 10.24 release line, run the following command:

```bash
git checkout mx/11.0
git checkout mx/10.24
```

You can find a complete list of supported Mendix versions and their branch names in the [GitHub Repository](https://github.com/mendix/make-it-native/branches/active).
Check the [Make It Native repository branches](https://github.com/mendix/make-it-native/branches/all) to see which versions are available. Project settings and build tools can vary by branch.

#### Install Dependencies

Make It Native, just like any other native apps, relies on third party dependencies that must be installed. Run the following commands to do so:
Install a version of [Node.js](https://nodejs.org/en) compatible with the branch you checked out. To build for iOS, use a Mac with a compatible version of [Xcode](https://developer.apple.com/xcode/resources/) and install [CocoaPods](https://guides.cocoapods.org/using/getting-started.html).

From the repository root, install the app dependencies:

1. Install dependencies:

```bash
npm install
```
```bash
npm install
```

1. Install pods (only for iOS):

```bash
cd ios && pod install && cd ..
```

If either command fails, make sure you have [Node.js](https://nodejs.org/en) and [CocoaPods](https://cocoapods.org) installed. To build Make It Native for Apple devices, you need an Apple computer.
```bash
cd ios && pod install && cd ..
```

### Additional Setup Requirements

Expand All @@ -65,8 +69,8 @@ To build and run the native mobile app successfully, you must complete several s
1. Create a Firebase Project:
1. Go to the [Firebase Console](https://console.firebase.google.com/) and create a new project.
1. Add your App to the Firebase Project:
1. For Android, add an Android application and follow the website's instructions.
1. For iOS, add an iOS application and follow the website's instructions.
1. For Android, register an Android app with the package name you use for your build.
1. For iOS, register an iOS app with the bundle identifier you use for your build.
1. Download configuration files:
1. For Android, download the *google-services.json* file.
1. For iOS, download the *GoogleService-Info.plist* file.
Expand All @@ -78,7 +82,7 @@ To build and run the native mobile app successfully, you must complete several s

##### Getting a Google Maps API key

Follow the instructions provided by Google [here](https://developers.google.com/maps/documentation/android-sdk/get-api-key) to obtain an API key.
Follow Google's instructions to get an API key for the [Maps SDK for Android](https://developers.google.com/maps/documentation/android-sdk/get-api-key) or the [Maps SDK for iOS](https://developers.google.com/maps/documentation/ios-sdk/get-api-key).

##### Integrate the API Key into an Android Project

Expand All @@ -89,117 +93,68 @@ Open your *android/app/src/main/AndroidManifest.xml* file and find the section w
android:value="YOUR_API_KEY_HERE"/>
```

##### Integrate the API Key into an iOS Project

To run iOS Fastlane script containing an API key, define the variable `GOOGLE_MAPS_API_KEY` before beta lane. If you run it manually in Xcode, change the API key in the *ApiKeys.xcconfig* file.

## Installing Fastlane

Once you have completed the additional setup requirements, you can proceed with building your applications. If you are building an iOS app, you must install Fastlane first.

If you are not building an iOS app, you can skip ahead to the [Android app building instructions](#build-android).

Fastlane is an all in one CI tool that automates the process of building and deploying apps. To install Fastlane, do the following:
##### Integrate the API Key into an iOS Project {#integrate-the-api-key-into-an-ios-project}

1. Install fastlane by gem
* `sudo gem install fastlane -NV`
1. Add these lines in `~/.bash_profile` or `~/.zshrc` (point the version to version installed):

```bash
export FASTLANE_PATH="/usr/local/lib/ruby/gems/2.6.0/gems/fastlane-2.134.0/bin"
export PATH="$FASTLANE_PATH:$PATH"
```
For manual Xcode builds, set `GOOGLE_MAPS_API_KEY` in `ios/DeveloperApp/Config/ApiKeys.xcconfig`. If the Fastlane lane you use reads `GOOGLE_MAPS_API_KEY` from the environment, set it before running that lane.

## Building

For [building iOS apps](#build-ios), Mendix uses Fastlane. Fastlane is an all in one continuous integration tool that automates building and deploying. Before proceeding, be sure to install Fastlane using the instructions above.

For [building Android apps](#build-android), the process is manual.
After installing dependencies and completing the setup, build the app for [iOS](#build-ios) or [Android](#build-android).

### iOS {#build-ios}

For Mendix apps, iOS builds are produced via Fastlane.

The configuration for Fastlane resides in `/ios/fastlane/Fastlane`. Currently three lanes are configured internal, build, and release:

* Internal should be used for internal test builds as in example detox
* Beta pushes the resulting `ipa` to Test Flight
* Release creates a new release in App Store Connect

Currently submitting the app for review is a manual step, but this might change.

{{% alert color="warning" %}}
For the **Beta** and **Release** lanes, before building, be sure to change the **VERSION_NUMBER** in the `Fastlane` config file manually.
{{% /alert %}}

#### Build an App for Internal Testing

To build your app for internal testing, do the following:
Build manually in Xcode, or configure Fastlane if you need to automate your builds.

1. Change directory into `/developerapp/ios`.
1. Run the `fastlane internal` command to build your app.
1. The output will reside in `/build/internal/output`, so grab your files from that directory.
#### Build Manually with Xcode {#build-ios-manually}

#### Releasing to TestFlight
You do not need Fastlane to build or sign the app in Xcode. The following steps use the `mx/10.24` branch as an example:

Change the VERSION_NUMBER in the `Fastlane` config file to your new version, then build:
1. Open `ios/DeveloperApp.xcworkspace` in Xcode, not the `.xcodeproj` file.
1. In `ios/DeveloperApp/Config/DeveloperApp.xcconfig`, set `BUNDLE_IDENTIFIER` to your own bundle identifier. Use the same identifier you registered with Firebase.
1. In the **DeveloperApp** target, open **Signing & Capabilities**. For a device build, select your Apple Developer team and configure signing. If you use automatic signing, select **Automatically manage signing**.
1. Select the **DeveloperApp** scheme and an iOS simulator or connected device, then choose **Product** > **Run**.

1. Change directory into `/developerapp/ios`.
1. Run the `fastlane beta` command.
To distribute the app, select a device build destination and choose **Product** > **Archive**. In the Xcode Organizer, select the archive and choose **Distribute App** to export a signed `.ipa` or upload the build to App Store Connect for TestFlight or the App Store. Before uploading, check [Apple's current submission requirements](https://developer.apple.com/app-store/submitting/). An older branch may build locally with a toolchain that Apple no longer accepts for uploads. For details, see [Distributing your app for beta testing and releases](https://developer.apple.com/documentation/xcode/distributing-your-app-for-beta-testing-and-releases).

The script will take considerable amount of time as it also waits for processing to finish, to release a TestFlight beta test.
#### Build with Fastlane

#### Releasing to App Store
The repository's Fastlane configuration is set up for Mendix builds. Before using it for your app, adapt it to your project:

Change the VERSION_NUMBER in the `Fastlane` config file to the new version, then build:
1. Follow the [Fastlane setup instructions for iOS](https://docs.fastlane.tools/getting-started/ios/setup/) to install Fastlane.
1. Review `ios/fastlane/Fastfile` and the other configuration files in `ios/fastlane` on your branch. Set your app's bundle identifier, signing team, certificates, and provisioning profiles. If the lane uses Fastlane Match, configure it to use your own signing assets. For uploads, configure [authentication with App Store Connect](https://docs.fastlane.tools/getting-started/ios/authentication/) and provide any environment variables the lane requires.
1. From `ios`, run the lane you configured. For example, on `mx/10.24`, `fastlane internal` builds for internal testing and `fastlane beta` uploads a build to TestFlight. The `beta` lane uses `APPLE_STORE_VERSION` in `Fastfile` for the app version. If you installed Fastlane with Bundler, run the command with `bundle exec`.

1. Change directory into `/developerapp/ios`.
1. Run the `fastlane release` command.

The script will take considerable amount of time as it also waits for processing to finish, to release a TestFlight beta test.
Uploading to TestFlight does not release the app on the App Store. To release it, select the uploaded build and submit it for review in App Store Connect.

### Android {#build-android}

Android builds are made via Android Studio:

1. Open Android Studio.
1. Open `/app/build.gradle` and change the `versionName` to the new version and `versionCode` to an integer value higher than the last release build.
1. Select `Build -> Generate Signed Bundle / APK`.
1. Select the `APK` check box.
1. On the next screen add the signing certificate.
1. Select `developerappRelease` from the build variants, and tick `V1` and `V2` Signatures.
1. Open the repository's `android` directory in Android Studio.
1. Open `android/app/build.gradle` and change the `versionName` to the new version and `versionCode` to an integer value higher than the last release build.
1. Choose **Build** > **Generate Signed Bundle / APK**, select **APK**, and configure signing. For details, see [Sign your app](https://developer.android.com/studio/publish/app-signing#sign_release).
1. Select your branch's release build variant. For example, on `mx/10.24`, select `productionRelease`.
1. Build your Android app.

## Set Up your Developer Environment

### iOS

iOS applications require Xcode, so we assume you have the latest version installed and ready to use.

Mendix uses CocoaPods to manage the iOS dependencies, which you can set up as follows:
For local development, follow [Build Manually with Xcode](#build-ios-manually).

1. To install CocoaPods on your system, run `sudo gem install cocoapods`.
1. To install NPM dependencies, run `npm i`.
1. Clean install the podfiles by running `npm run ios:clean-pod-install`
1. Install provision profile and certificates by running `npm run ios:dev`, then enter your machine password.
1. Open the project via the `*.xcworkspace` file (not the `xcodeproj`).
#### When to Reinstall Dependencies

#### When to Re-Install CocoaPods

From to time you must update the native dependencies. Therefore, it is important to re-install the node modules and CocoaPods in the following cases:

* After a branch switch
* If the app exhibits erratic or odd behavior
After switching branches, reinstall the npm dependencies and pods. If the app behaves unexpectedly, reinstalling the dependencies can also help.

### Android

Set up your developer environment for Android as follows:

1. Install a recent Android Studio version.
1. Open the project in `developerapp/android` as existing project or import it as Gradle project.
1. Open the repository's `android` directory as an existing project or import it as a Gradle project.
1. [Update or install a recent SDK](https://developer.android.com/studio/intro/update#sdk-manager).
1. [Install a recent NDK](https://developer.android.com/studio/projects/install-ndk).
1. Switch the Build Variant in Android Studio (on the lower-left side) to `developerappDebug` unless it has been selected by default.
1. Select your branch's debug variant in Android Studio. For example, on `mx/10.24`, select `productionDebug`.
1. Start a Gradle sync.
1. If successful, the green play button should be usable.

Expand Down Expand Up @@ -239,9 +194,7 @@ To work around this, do one of the following:

### iOS

To configure Google Maps functionality, do the following:

* To run a iOS FastLane script containing an API key, please define the variable `GOOGLE_MAPS_API_KEY` before beta lane. If you run it manually in Xcode, change the API key in `ApiKeys.xcconfig` file.
See [Integrate the API Key into an iOS Project](#integrate-the-api-key-into-an-ios-project).

### Android

Expand Down