Mendix 9 Native dependency management

Published in
3 min readMar 15, 2021

--

Mendix Studio Pro 9 brings us many great new features, with the official release drawing nearer, the public beta releases already deliver some really nice items, which deserve more attention than they got so far.

The one I would like to highlight in this post is Native dependency management.

Mendix 8 brought us native apps and the option to build them as true Appstore apps. However, some libraries need to integrate with the device. This could result in manual work for the developer that prepares the APK or IPA file: configure the native dependencies. And restore that config with each update of the native template used to create the Appstore apps.

For example, my Native File Documents module has such dependencies, which allows us to view file documents on the device.

Mendix 9 takes away that burden, by allowing module and widget developers to specify which native modules are required. By downloading the content from the Market Place, that information becomes available to the native app builder. Now you can create apps and take advantage of new features in the native builder, without the hassle of getting these dependencies right.

https://bit.ly/MXW21
https://bit.ly/MXW21

For using existing content in your app, that’s all there is to it, the technicalities are dealt with for you. For those who want to include native libraries in their app or Market Place content, let’s take a look at the magic behind this feature.

Mendix describes it in detail in the documentation page about declaring native dependencies, I will explain it here as well using my module as an example.

To let the builder know you need native libraries for your app to work, you need to create a JSON file. For Pluggable widgets, it must have the same name as your widget’s XML file, for JavaScript actions, it needs to have the same name as the JS action, in both cases with a .json extension. For the Native File Documents module, I picked the IsNativeFileSystemAvailable JavaScript action, so I created IsNativeFileSystemAvailable.json and here is the content:

{
"nativeDependencies": {
"react-native-file-viewer": "2.1.4",
"react-native-fs": "2.16.6"
}
}

Note that you must use an exact version, so no ^ or similar in the version number.

When the builder detects conflicts in the required dependencies, it will popup a message.

Note that you may already include the JSON file in your module, Mendix 8.18.x does not pick it up but at least you don’t need to maintain separate versions of your module just to add the JSON file!

This feature makes it much more easy to bring great React Native libraries to Mendix, without the hassle of keeping the build running. Just adding the widget or module to your project will make sure everything keeps working. The only thing required for development is to create a development app, allowing the development team easy access to the native functions as well.

Read more

From the Publisher -

If you enjoyed this article you can find more like it at our Medium page or at our own Community blog site.

For the makers looking to get started, you can sign up for a free account, and get instant access to learning with our Academy.

Interested in getting more involved with our community? You can join us in our Slack community channel or for those who want to be more involved, look into joining one of our Meet ups.

--

--

Marcel Groeneweg
Mendix Community

Mendix MVP and Certified Expert. Focus on Mendix native mobile apps and widgets.