Skip to content

Troubleshooting

Overview of common issues.

The Specified Key for the New Entity Is a Duplicate of an Existing Entity

Problem: When creating an entity, you might encounter the error message: Create entity failure – Error: com.sap.cloud.mobile.odata.DataServiceException: [-10103]. The specified key for the new entity is a duplicate of an existing entity.

Workaround: When you are creating an entity, there will always be a unique key for that entity. Depending on your service, it may automatically assign the key when you create the entity or it may want the client to provide the key. If the back-end is assigning keys and you are offline, then you need to provide a unique local key for offline use until you sync with the back-end. It could be that you are specifying the same id value for each create, which the offline store reports as a key conflict. You may need to write a rule to generate a local unique key for use when creating entities.

Create Entity Failure With 500 Internal Server Error

Problem: Creating a record from Postman, it works fine but from MDK app, you encounter the error message:

https://<MobileServicesEndpoint>/Products
{
code: 500, message: internal Server Error
}  

Workaround: An error 500 indicates the back-end server had a problem processing the request. In such scenarios, check the logs of the back-end for additional information. Also, to better troubleshoot the issue, it is recommend to turn on Mobile Network Trace to capture exactly what the MDK client is sending to the back-end. You may need to add this feature to your application in Mobile Services if it is not listed. For example: using that trace, you might see that the following is being sent by MDK client for the create entity.

"postData": {
"mimeType": "application/json",
"params": [],
"text": "{\"@odata.type\":\"#CatalogService.Products\",\"ID\":101,\"name\":\"Printer\"}" },

In the above example, the root cause is that the back-end is not properly handling @odata.type property and should to be updated to be OData compliant. You can work around this in your MDK application. Log in to SAP Business Application Studio or SAP Web IDE and navigate to your MDK application that was generated from the CRUD template.

  • Expand the Services folder and double click on the .service file for your application.
  • Choose > before Service Options to expand the list of options.
  • Check the box for requiresType and leave the drop-down value set to False.
  • Save your service definition.
  • Deploy and activate your change and test on your device.

This should allow your create or update to process from MDK.

No Usable Data Found

Problem: While scanning the on-boarding QR code on iOS device, you encounter the error message: No Usable data found

Workaround: The No usable data found message will occur on iOS if there are no applications installed on the device that can handle the URL scheme in the QR code. Have you installed the SAP Mobile Services Client from the Apple App Store on your device already? If yes, did you change the URL Scheme from the default sapmobilesvcs value in the Onboarding dialog? The App Store client expects the URL Scheme to be sapmobilesvcs so please confirm this is the value used.

Could Not Find Module 'SAPMDC' for Target 'x86_64-apple-ios-simulator'; found: arm64

Problem: While running tns run ios --emulator, you may encounter the error message: Could not find module 'SAPMDC' for target 'x86_64-apple-ios-simulator'; found: arm64

Workaround: It could be that when your ran create client you would have specified a device instead of a simulator. Try recreating your client and pick a simulator for the client type.

Authentication Failed. Please Try Again. The Newly Acquired or Refreshed Token Got Rejected

Problem: In MDK client, you encounter the below error message during on-boarding: Authentication failed. Please try again. OAuth2Error.tokenRejected: The newly acquired or refreshed token got rejected

Workaround: Check your connection settings. If your client id is incorrect or there are issues in the URLs that might explain the error.

Unable to Build Release APK Without Signing Keystore

Problem: Tried to generate unsigned release APK file for Android, but tns run android --release requires signing keystore.

Workaround: It's not possible to do that with TNS CLI, NativeScript does not support that. But there's a workaround:

  1. Go to your <generated-app>/platforms/android/app/build.gradle
  2. Find signingConfig signingConfigs.release and change it to signingConfig null
  3. In the command line or terminal navigate to: /platforms/android/ and execute the following:
./gradlew assembleRelease -Prelease

Once completed, you can find the unsigned apk at <generated-app>/platforms/android/build/outputs/apk/release/app-release-unsigned.apk

Custom Client Build Failed With ID: Framework Not Found MDFInternationalization error

Problem: Branded client built via tns build ios or tns run ios or via Xcode is failing with ld: framework not found MDFInternationalization error.

Cause: Your client has overridden the build.xcconfig in .mdkproject/App_Resources/iOS/build.xcconfig and it's missing IPHONEOS_DEPLOYMENT_TARGET property.

Solution:

  1. Go to your target MDKClient SDK folder and go to: App_SDK/template/app/App_Resources/iOS/build.xcconfig.
  2. Look for IPHONEOS_DEPLOYMENT_TARGET = XX.X XX.X is the target version number. For example, IPHONEOS_DEPLOYMENT_TARGET = 12.0
  3. Copy that and add that to your build.xcconfig in your .mdkprojectfolder.
  4. Re-generate your project via the create client command.

Xcode Build Failed With ID: Framework Not Found MDFInternationalization error

Problem: Your project build is still ailing in Xcode with ld: framework not found MDFInternationalization error. and you already have IPHONEOS_DEPLOYMENT_TARGET in your build.xcconfig or have not previously modified build.xcconfig

Cause: You may have opened .xcodeproj instead of .xcworkspace in the platforms/ios folder.

Solution:

  1. Close the current Xcode window that opened the .xcodeproj
  2. Open the .xcworkspace

Custom Client Build Failed With 'MaterialMath.h' File Not Found Error

Problem: Branded client built via tns build ios or tns run ios is failing with the following errors or similar errors:

/Users/JohnDoe/Downloads/MDKCLNT02P_3-80005072/MDKClient_SDK/MyMDKApp/platforms/ios/Pods/MaterialComponents/components/Elevation/src/UIColor+MaterialElevation.m:19:9: fatal error:
'MaterialMath.h' file not found
#import "MaterialMath.h"
^~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
** BUILD FAILED **

Unable to apply changes on device: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. Error is: Comman

Cause: One or more Pods components' cache are corrupted. Pods dependencies are usually installed from cache if available. So, it's likely caused by a badly cached dependency (interrupted or incomplete installation of that dependency previously). The cache can be found in ~/Library/Caches/CocoaPods

Soultion: Option 1: Executing the following command in the terminal: pod cache clean should clean the cache and allow the pod dependency to be re-installed in the next try.

pod cache clean MaterialComponents

Option 2: Delete the CocoaPods folder in ~/Library/Caches/. This will force all of the Pods dependencies to be downloaded and installed as fresh. Re-run the tns build ios or tns run ios command.

Loading Message Displays While Running MDK Dependency Installer on Windows Machine

Problem: MDK Dependency installer on Windows Machine gets stuck in loading.

Workaround: This issue can be due to Security Policy. If permitted, you can execute the following command in Power Shell:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser

Last update: October 20, 2020