Get ready to build your first MDK client with the dependencies installer
+++ Update: Learn about this topic in this tutorial: https://developers.sap.com/tutorials/cp-mobile-dev-kit-build-client.html +++
The mobile development kit (MDK) dependencies installer is an application that checks that your computer has the correct version of the components required to successfully build a customized MDK Client. The mobile development kit is a feature of SAP Cloud Platform Mobile Services. The MDK dependencies installer is now available for computers running macOS and Windows. The macOS version validates iOS and Android components while the Windows version validates only Android. The new version of the MDK dependencies installer application includes usability enhancements that improve the reporting and make resolving issues easier.
SAP has recently released version 3.0 of the MDK dependencies installer. MDK 3.0 includes the MDK SDK for Android and adds Microsoft Windows as a supported client build environment for Android clients. Note that this is currently restricted to Early Adopter Care program members. Click here if you are interested in joining the Early Adopter Care program for SAP Cloud Platform Mobile Services mobile development kit 3.0.
As a reminder, there are three options for the MDK clients and I posted a blog with general guidelines for when to use each option. As mentioned in that blog, if your MDK app includes custom controls, then the only client option is to build a customized MDK client on a local computer. Running the MDK Dependencies Installer application will help ensure that you are successful building a customized MDK client.
What does the MDK Dependencies Installer do?
Basically, the application scans your computer for all required components and validates that each component is at the required version level. After each scan, the dependencies installer displays the results for each component. The application displays the following items for each required component:
- The name of the component, includes a link to the web site to learn how to install the component.
- Either an Information icon or a check box on the left side.
- For most components you will see the information box. Information about each component in the information box to the left of the name. In most cases, when you click on the information box you view basic information and then can go to the vendor’s web page to learn more and download the component. Most of the components relate to Android Studio, and as you will see in the examples below the Android Studio SDK Manager is the best way to install those missing components as well as to resolve one of the environment variable issues.
- For a few components (Chocolately, Node.js and Native Script), the check box indicates that the application can download and install the required version of the component directly. There is a Select All check box on the top left. When you select that the application selects all the installable components. You can then click on the Install Selected Components button on the toolbar on the bottom and the application will download and install each.
- A green check and link to Show Result if the component is valid.
- A red X and a link to Show Issue if it is missing or not the correct version.
The application starts a scan as soon as you launch it. You can click on the Check Component Compatibility button on the toolbar on the bottom to scan again. After each scan, the application displays an overall scan result message along the top.
What does the MDK Dependencies Installer not do?
The application cannot install or solve these issues:
- Android Studio components like the platform API, the build-tool libraries and the Android Emulator (Android Virtual Device). Android Studio includes management tools to select and install specific libraries and components. The example below includes fixing a couple Android Studio issues.
- Environment variables and path issues that require making changes to the operating system properties. The example below starts with fixing one of these.
- Prevent component conflict issues when the installed version of a component is newer than the MDK Dependencies Installer. For components like Chocolately, Node.js and Native Script the application could show that the component version is correct if it is a higher version, but you could encounter errors when building a client. In those cases, you may want to remove the components and let the application try to re-install the older version.
How do I get the MDK Dependencies Installer?
The MDK dependencies installer is included in the MDK SDK packages in SAP Software Downloads > Support Packages and Patches.
Where does the extraction process put the MDK Dependencies Installer?
For Windows, you will need to unzip MDKDependenciesInstallerWindows.zip. The extraction process creates a folder named MDK Dependencies Installer-win32-ia32. Open that folder, find and launch MDK_Dependencies_Installer.exe.
End to End Example
Let’s start with the most common dependency issue where the MDK Dependencies Installer cannot find the ANDROID_HOME environment variable. As you can see below, I have 9 components that do not pass the requirement to build a client from the MDK SDK. The first one is the ANDROID_HOME path is invalid. When I click on Show Issue and then on View Details, I see the screen shot below.
While the message may not give me complete instructions on how to solve this, when I search the internet for “how to set up the android_home environment variable” I see that there are many sources to help me fix it. From one of those sources I see a suggestion for how to permanently set ANDROID_HOME. I right click on My Computer, then on Properties which brings up Control Panel > System and Security > System. On the left side of the System page I select Advanced system settings which as advertised opens the Advanced tab of System Properties.
From there I select the Environment Variables button which opens a dialog box where I can create/edit/delete User and System variables.
I click on New under System variables to create a new one.
But where do I find the correct value? In Android Studio. I open Android Studio, then click on SDK Manager icon on my toolbar. You could also click on File > Settings > Appearance & Behavior > System Settings > Android SDK. On that page you will see your Android SDK Location value.
Copy that value by clicking on Edit the select and copy (control C) the value, click cancel and go back to the New System Variable dialog in System Properties. Paste the value from Android SDK Location from Android Studio in to the Variable value box. Then enter ANDROID_HOME into the Variable name box.
Click OK to save and close the New System Variable dialog. Then click OK to close the Environment Variables page, OK to close System Properties.
Now go back the MDK Dependencies Installer and click on Check Components Compatibility to start a new check. In my case the ANDROID_HOME environment variable was responsible for a lot of the issues. Now I only have 2 issues.
To resolve the Android SDK 27 issue, I open Android Studio and then open then open SDK Manager. In SDK Manager on the SDK Platforms tab, I select API Level 27 and then click the Apply button (lower right).
I click OK to in the dialog to confirm the start the installation of Android SDK API 27. It may take Android Studio several minutes to download and install each Platform API Level. When that is done, click Finish.
Run the MDK Dependencies Installer again (click on Check Components Compatibility). As you can see below I have one more issue to resolve. I need Android SDK Build-Tools 27 (any version between 27.0.2 and 27.0.99, basically 27.0.2 or newer).
Back in Android Studio SDK Manager, select the SDK Tools tab and then check the box next to Show Package Details in the lower right to expand the Android SDK Build-Tools. I then select 27.0.3 because that’s what the MDK Dependencies Installer suggest.
Next, I click the Apply button (lower right) and then click OK to confirm the change. When the download and installation is complete, I click on Finish.
I run the check one more time and this time everything passes!
What do I do next?
You can now customize and build the MDK client on your computer from the MDK SDK. You can add custom controls, include the app endpoints, define your own schema name plus specify the version, the bundle id, the icon and the display name. The steps to create and build a customized client are in the MDK Client User Guide.
While the title of this blog alludes to using the MDK dependencies installed to build your first MDK client, I recommend that you run the MDK dependencies installer every time you download a new version of the MDK SDK (there will likely be an updated MDK dependencies installer in that package), after any of the required components change and, of course, if you run into errors while creating a client.