Skip to content

Common Issues

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 Mobile Development Kit 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 Mobile Development Kit 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 Mobile Development Kit 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 Mobile Development Kit application. Log in to SAP Business Application Studio or SAP Web IDE and navigate to your Mobile Development Kit 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 Mobile Development Kit.

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 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 Mobile Development Kit 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

Solution: 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 Mobile Development Kit Dependency Installer on Windows Machine

Problem: Mobile Development Kit Dependency installer on Windows Machine gets stuck in loading.

Workaround: This issue can be due to Security Policy. If permitted, execute the following command in Power Shell window and then try to run the dependency installer again:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser

Alternatively, you can also try the following if the previous method does not work:

  1. Open PowerShell (as administrator, if possible)
  2. cd to <MDK_SDK folder>/MDK Dependencies Installer-win32-ia32/resources/app/cli/
  3. Run the command:

    sh powershell -file main.ps1 check

Unable to Sync Service Metadata

Problem: Unable to sync service metadata when SAP Business Application Studio and Mobile Services are not in the same subaccount.

Workaround:

  • Option 1

Using Passcode

Enable Cross Context SSO setting under Security for the corresponding app in the mobile services app configuration, and in the Mobile Development Kit editor you will get passcode from mobile services login page. You can connect to the mobile application by using the passcode.

  • Option 2

Auto Connection

While connecting to an SSO-enabled mobile destination from SAP Business Application Studio, there are two prerequisites:

  1. The developer should have the role "Business_Application_Studio_Administrator".
  2. SAP Business Application Studio and SAP Mobile Services should be in the same subaccount.

In the background, the Mobile Development Kit editor will try to use the SAP Business Application Studio JWT token to get the mobile services access token, which must be in the same subaccount.

If you can't add them to the same subaccount, you can either:

  1. Change the SSO mechanism to basic authentication in your mobile destination for SAP Business Application Studio's access.
  2. Manually download $metadata and upload it in SAP Business Application Studio. Select the local file as the data source while creating a new project or a new service.

JavaScript Heap Out of Memory During Bundling on SAP Business Application Studio

Problem: When deploying a project in SAP Business Application Studio, you might encounter the error message: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Workaround: In SAP Business Application Studio, add the following script at the end of the file /home/user/.bashrc to increase the memory.

export NODE_OPTIONS="--use-openssl-ca --max-old-space-size=8192

SAP Web IDE Bundle Failed by nativeclass Transformer

Problem: When deploying a project in SAP Web IDE, you might encounter the error message: Error: Cannot find module '@nativescript/webpack/dist/transformers/NativeClass

Workaround: Using latest mdk-tools 1.9.0

  1. Delete the package-lock.json file from the folder MDKWebpackFactory
  2. In package.json file, change @sap/mdk-tools to 1.9.0
  3. Redeploy your project

Last update: September 24, 2024