In this blog, I will go through the most common issues users have encountered when building applications with Mobile development kit (MDK), part of SAP Cloud Platform mobile services. Most of these issues are due to simple configuration mistakes, typos, incorrect authentication, etc. These issues can usually be resolved easily without filing an incident and I’m hoping this blog will help you do that.
If this is your first introduction to the mobile development kit, I suggest you first review content that provides a great introduction to the feature before proceeding with this blog.
Note: The feature name has recently changed from SAP Enterprise App Modeler to mobile development kit. You may see the previous name in the product and/or other content.
- Blog: Mobile Development Kit
- Mobile Development Kit Learning Map
- SAP HANA Academy: Mobile Development Kit
This is a living blog. As I find more tips that are helpful, I will update this blog and share info to troubleshoot your applications. I have not captured all of the possible errors, but just the most common ones to date. At the end of this blog, I provide generic ways to troubleshoot different areas of the application.
The following issues are covered in this blog.
- OData Initialization Failed message from client
- Application loads successfully, but screen is blank
- OAuth information blank in Mobile Services
- TNS run command fails
- 404 error in SAP Web IDE when creating the service for the application
- Error: Can’t get data from App Update
- Mobile development kit Client fails to start & BrandedSettings.json not found in the terminal log
- LoggerManager has not been initialized yet!
- General Troubleshooting Tips
This message is received when viewing the application in the mobile development kit client. The mobile development kit client can be either the app on the device or in the simulator. The exact failure message received is based on the message you provided when creating the OData Initialization Failure message action. This means that the OData Offline Initializes Action has failed to download the data needed to run the application. This is often caused by a connection failure to the data.
Here are places you need to check to resolve this issue
Mobile development kit Editor in Web IDE
Look at the services connection. Open the file under the Services folder and click on Refresh Object. If this fails, then this is most likely the cause of the problem and needs to be resolved.
Check the information entered in the Service Editor
- Service URL: this service destination path comes from SAP Cloud Platform Cockpit. You can view your destinations by click on the following in SAP Web IDE: Tools -> SAP Cloud Platform Cockpit
Click on Destinations. You should see your destination to Mobile Services here. This is how SAP Web IDE connects to Mobile Services.
You can click on the destination name and view the configuration details. Make sure the destination was setup properly. You can view the SAP HANA Academy – Mobile Development Kit: Setup Environment video to verify settings.
- Application ID: this is the ID from Mobile Services. You can find this ID by going to Mobile Service for Development and Operations -> Mobile Applications -> Native/Hybrid -> <App Name>
- Destination Name: this is the connection to the backend data available from within Mobile Services. You can find this name by going to Mobile Service for Development and Operations -> Mobile Applications -> Native/Hybrid -> <App Name> -> Connectivity
Verify the destination name is correct and you receive a successful Ping from this destination. You will also want to click on the destination and verify that your username / password to connect to Mobile Services is valid.
Note: if your password has recently changed, you need to update it here. Click on the pencil icon to edit the destination and then click Next until you get to the User Name / Password screen. Update the information.
Mobile development kit Client
If the Refresh Objects test succeeds, then let’s move on to other areas to evaluate. The mobile development kit client also must properly authenticate to SAP Cloud Platform to download the data. You may want to try the following:
- Kill the app in the simulator or device and restart the application. This will force the application to re-authenticate with SAP Cloud Platform.
You have created a page for your application and added data, but when you deploy your application to Mobile Services and then to the mobile development kit client, you get a blank page instead of the data you expect. Here are few areas to check.
- Turn on OData debugging in the client. Follow the instructions in the General Troubleshooting section of this blog
- For Offline OData, check that the client database downloaded. View this blog for more information
- Check that the target for the page has been set. If you create a page in the Editor such as a Product List page and you forgot to set a target for that control, you will receive a blank page even if you have set properties elsewhere for that control. In the screenshot below, the Target for the Product list is mapped to the Products collection.
- Check BrandedSettings.json file. Make sure there are no smart quotes, typos, errors in the file
Another reason your screen may be blank is that you recently created a rule in the editor that the client is unable to parse properly. Turn on client logging for more information or remove your newly created rule from the application to see if that solves your problem.
To turn on client logging, view that section under General Troubleshooting.
You are following the steps from the SAP HANA Academy tutorials for Mobile development kit. You get to the step where you create your “App Modeler” app in Mobile Services and then you click on Security and switch the Authentication from SAML to OAuth. The video shows that the OAuth information is immediately published in the table on that page, but your screen has no data in the table. If you click on the + icon for that table – everything there is blank too. What gives?
There is an easy fix for this. It looks like there was recently a minor change in Mobile Services. Click on the Save button and you should now see that information populated for you. You can continue with building your application.
In order to start the application, you need to do a tns run command in the terminal. If your tns run command fails, often this is due to having more than one Xcode version installed and/or you are not using the correct version for the mobile development kit. Here, you have different options based on your situation.
- If you are using tns run command to simply run your mobile development kit client, use the xcode-select command in terminal to choose the latest version of xcode 9.x to use and this would work fine.
- If you are using the tns run command to developer custom extension contronsl, you must use the same Xcode version as what the MDK client was built with. So, for MDK 2.0.1, Xcode 9.0.1 should be used. If both versions of Xcode are installed,
- Use the xcode-select command in terminal to choose the version of Xcode to use for the mobile development kit client
- Run the application via Xcode directly. This is generally the easiest thing to do as you are using Xcode to develop in SWIFT anyway.
When you create the service for the application, SAP Web IDE will make a connection to SAP Cloud Platform mobile services and attempt to contact the destination you specified. If you receive a 404 error in SAP Web IDE, you may want to check the following:
- Check the destination in the SAP Cloud Platform Cockpit and make sure it is setup properly
- Check that the cross domain access is setup in Mobile Services
The easiest way to get to destinations is from SAP Web IDE. SAP Web IDE: Tools -> SAP Cloud Platform Cockpit
If you receive an error from the client logs that it cannot get data from App Update in Mobile Services, this is most likely due to an invalid application type.
Go to Mobile Service for Development and Operations -> Mobile Applications -> Native/Hybrid and click on your application. Then click on App Update. Under Application Version, you should see App Modeler under the Type column.
If the application is not an App Modeler application, you will need to recreate the application in Mobile Services and setup the application for the mobile development kit again.
The mobile development kit Client fails to start & BrandedSettings.json not found in the terminal log
When starting the mobile development kit client from the simulator, it uses the BrandedSettings.json file to make a connection to SAP Cloud Platform mobile services and a specific application. Here are some common issues encountered from entering information in the BrandedSettings.json file
- Check the BrandedSettings.json for smart quotes, typos, missing commas, etc.
- Check that there is a BrandedSettings.json file in <MDK Client>/<app name>/branding.
- Here is an example of a properly working BrandedSettings.json file
You may receive this message in the client log during or after initialization of Offline OData. This can be caused by having something specified in “Log Success”, “Log Invalid” or “Log Failure” of the Initialize Offline OData action. A client limitation prevents this from working in some situations. If you accidentally entered your success and/or failure message in one of these fields instead of the Success Action and Failure Action fields, that may be causing the problem. The Solution is to remove these messages from the action.
If you have not received one of the issues listed above or you have tried the resolution tips listed above and you are still having issues, here are some general troubleshooting tips that can help any situation.
Turn on logging from the client
This is for the simulator only in mobile development kit 2.0. You can turn on logging at the client level and get more specific detailed information about what errors and/or issues the client is running into when trying to run the application.
- Turn on OData logging in the client. This can be done in the BrandedSettings.json file
- You can also turn on general client logging from another terminal window.
- Open a terminal session and run log command to stream log and filter for your application
log stream –level debug –predicate ‘senderImagePath contains “mdkclient” –style syslog
Where “mdkclient” is the name of the application used when creating the app via ./install.sh
- “Mine” the actions and other objects with logging statements
- Beware that the logger needs to be initialized first
Turn on logging at the Mobile Services level related to OData
Sometimes the OData errors are in the Mobile Services layer. This logging can help you verify that or rule that out as a problem.
Places to check when encountering OData issues
- Can you connect from Mobile Services? Do a test from Connectivity in Mobile Services
- Check your Mobile Services destination
- If you go to create a new service for your mobile development kit application and the service destination is empty then something is wrong with the destination.
- You can view your destinations by click on the following in SAP Web IDE -> Tools -> SAP Cloud Platform Cockpit.
- You can click on the destination name and view the configuration details. Make sure the destination was setup properly. You can view the SAP HANA Academy – Mobile Development Kit: Setup Environment video to verify settings.
- Check that the Offline Store was downloaded. View this blog for more details.
- Ensure the OData connection works from the backend.
- Run the OData command inside the backend system using transaction /IWFND/GW_CLIENT
- Check the SAP Cloud Connector to verify the OData service is properly exposed
General Rule troubleshooting
If you or the client is having issues with mobile development kit rules, you have a few options to troubleshoot your rule.
- Add breakpoints to your rule in the Editor
- You can debug your rule through the NativeScript debugger. This is done by running Node in debug mode.
- Connect the Visual Studio code debugger for more rule debugging