Troubleshooting

How to resolve a “NoClassDefFoundError org/apache/http/HttpHost” error?

2021-04-27 19:11:23.145 13751-13967/? E/AndroidRuntime: FATAL EXCEPTION: pool-4-thread-1
    Process: com.teramoto.microvpnbrowser.test1, PID: 13751
    java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/HttpHost;
        at com.citrix.mvpn.MAM.Android.AuthSSO.d.d.<init>(Unknown Source:9)
        at com.citrix.mvpn.MAM.Android.AuthSSO.d.d.a(Unknown Source:19)
        at com.citrix.mvpn.MAM.Android.AuthSSO.proxy.Helper.b(Unknown Source:70)
        at com.citrix.mvpn.MAM.Android.AuthSSO.proxy.Helper.a(Unknown Source:58)
        at com.citrix.mvpn.helper.b.a(Unknown Source:21)
        at com.citrix.mvpn.service.MITMService$b.run(Unknown Source:55)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
    Caused by: java.lang.ClassNotFoundException: org.apache.http.HttpHost
        at com.citrix.mvpn.MAM.Android.AuthSSO.d.d.<init>(Unknown Source:9) 
        at com.citrix.mvpn.MAM.Android.AuthSSO.d.d.a(Unknown Source:19) 
        at com.citrix.mvpn.MAM.Android.AuthSSO.proxy.Helper.b(Unknown Source:70) 
        at com.citrix.mvpn.MAM.Android.AuthSSO.proxy.Helper.a(Unknown Source:58) 
        at com.citrix.mvpn.helper.b.a(Unknown Source:21) 
        at com.citrix.mvpn.service.MITMService$b.run(Unknown Source:55) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 

Cause

MAM SDK uses the legacy Apache HTTP library. The app must explicitly allow the use of this library.

Fix

The following snipept needs to appear in the generated AndroidManifest.xml file’s <application> section:

<uses-library android:name="org.apache.http.legacy" android:required="false" />

Do not modify AndroidManifest.xml directly. For the preceding snippet to be present in the generated AndroidManifest.xml file, add the following snippet to the config.xml:

<config-file target="AndroidManifest.xml" parent="/manifest/application">
    <uses-library android:name="org.apache.http.legacy" android:required="false" />
</config-file>

See Cordova’s docs on config-file for more information.

How to resolve a “Failed to obtain ContentProviderClient for MDXProvider” error?

Google has updated the Play Store requirements to update target SDK version to 30 starting from August 2021 for new apps, and from November 2021 for app updates. MAM SDK integrated apps targeted for SDK version 30 will fail with this error.

2021-04-27 19:36:05.530 16321-16387/? E/ActivityThread: Failed to find provider info for com.citrix.work.MDXProvider
2021-04-27 19:36:05.530 16321-16387/? E/CORESDK-PolicyAPI: Failed to obtain ContentProviderClient for MDXProvider
2021-04-27 19:36:05.530 16321-16387/? E/CORESDK-PolicyAPI: Failed to obtain ContentProviderClient for MDXProvider
…
021-04-27 19:36:05.557 16321-16392/? E/"MVPN-SHTunnelConfig": "ERROR     ( 2)","Failed to obtain ContentProviderClient for MDXProvider"
…
2021-04-27 19:36:05.557 16321-16387/? E/ActivityThread: Failed to find provider info for com.citrix.work.MDXProvider

Cause

Android SDK version 30 added new restrictions to Package Visibility.

Fix

The following snippet needs to appear in the generated AndroidManifest.xml file’s <manifest> section:

<queries>
    <package android:name="com.zenprise" />
    <package android:name="com.citrix.Receiver" />
</queries>

Do not modify AndroidManifest.xml directly. For the preceding snippet to be present in the generated AndroidManifest.xml file, add the following snippet to the config.xml file:

<config-file target="AndroidManifest.xml" parent="/manifest">
    <queries>
        <package android:name="com.zenprise" />
        <package android:name="com.citrix.Receiver" />
    </queries>
</config-file>

See Cordova’s docs on config-file for more information.

How to resolve a “Cannot find module ‘uuid’” error?

Adding @citrix/cordova-plugin-android-mvpn to package.json
Cannot find module 'uuid'
Require stack:
- <path>/cordova-mvpnsampleapp/plugins/cordova-plugin-android-mvpn/scripts/common.js
- <path>/cordova-mvpnsampleapp/plugins/cordova-plugin-android-mvpn/scripts/android/android_setup_mdx.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/plugman.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/cordova-lib.js
- /usr/local/lib/node_modules/cordova/src/help.js
- /usr/local/lib/node_modules/cordova/src/cli.js
- /usr/local/lib/node_modules/cordova/bin/cordova
<!--NeedCopy-->

Cause

Adding the @citrix/cordova-plugin-android-mvpn plugin generates the following error message: Cannot find module 'uuid'. This error happens because of a missing node module named uuid.

Fix

Install the uuid node module.

npm install uuid

How to resolve a “Failed to fetch platform cordova-android@^x.x.x” error?

cordova-mvpnsampleapp % cordova platform add android

Using cordova-fetch for cordova-android@^9.1.0
Failed to fetch platform cordova-android@^9.1.0
This is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
CordovaError: Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @citrix/cordova-plugin-android-mvpn@^21.7.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
<!--NeedCopy-->

Cause

If you are using the sample app cloned from Citrix GitHub, a plugin version mismatch might occur in the package.json file. In npmjs.com, the latest version of the plugin available is 21.6.1. This will be updated in the future.

Fix

Open the package.json file and modify the line "@citrix/cordova-plugin-android-mvpn": "^21.9.0", to "@citrix/cordova-plugin-android-mvpn": "^21.6.1",.