citrix / citrix-mam-sdks

The MAM SDK instrument your apps to enable enforcing policies and controls that are configured in Citrix Endpoint Management.
https://developer.cloud.com/citrixworkspace/mobile-application-integration
11 stars 4 forks source link

Android - using 22.x results in NoClassDefFoundError for class IAMLClientDependency #70

Closed choutman closed 2 years ago

choutman commented 2 years ago

In order to update our Android app to api 31 (and 32) we were forced to update the mam sdk from 21.x to 22.x. To be exact, version 22.5.0.4. It is no problem to build the application. At runtime, however, the app crashes with a NoClassDefFoundError; please see below for the stacktrace.

To be sure the problem is not related to our code, I applied the same changes to your sample app. Which resulted in the same error. Please see this repo to reproduce the error.

Stacktrace: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/citrix/authmanagerlite/IAMLClientDependency; at com.citrix.sdk.auth.api.AuthSDK.initialize(Unknown Source:0) at com.citrix.sdk.appcore.api.a.d(Unknown Source:17) at com.citrix.sdk.appcore.api.a.b(Unknown Source:11) at com.citrix.sdk.appcore.api.a.a(Unknown Source:45) at com.citrix.sdk.appcore.api.MamSdk.<init>(Unknown Source:10) at com.citrix.sdk.appcore.api.MamSdk.getInstance(Unknown Source:27) at com.citrix.mvpn.helper.d.<init>(Unknown Source:5) at com.citrix.mvpn.helper.b.a(Unknown Source:19) at com.citrix.mvpn.helper.e.i(Unknown Source:6) at com.citrix.mvpn.helper.e.a(Unknown Source:10) at com.citrix.mvpn.api.MicroVPNSDK.startTunnel(Unknown Source:4) at com.citrix.mvpntestapp.util.VpnUtil.startTunnel(VpnUtil.java:18) at com.citrix.mvpntestapp.activities.StartTunnelAndSendNetworkRequestActivity.onCreate(StartTunnelAndSendNetworkRequestActivity.java:59) at android.app.Activity.performCreate(Activity.java:8282) at android.app.Activity.performCreate(Activity.java:8262) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1335) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4005) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4197) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2434) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8633) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.citrix.authmanagerlite.IAMLClientDependency" on path: DexPathList[[zip file "/data/app/~~hqc7MAZ7tLj9z4GkDeGH8Q==/com.citrix.mvpntestapp-ykcKFk28n-hr6s5o2YS3pQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~hqc7MAZ7tLj9z4GkDeGH8Q==/com.citrix.mvpntestapp-ykcKFk28n-hr6s5o2YS3pQ==/lib/arm64, /data/app/~~hqc7MAZ7tLj9z4GkDeGH8Q==/com.citrix.mvpntestapp-ykcKFk28n-hr6s5o2YS3pQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.citrix.sdk.auth.api.AuthSDK.initialize(Unknown Source:0)  at com.citrix.sdk.appcore.api.a.d(Unknown Source:17)  at com.citrix.sdk.appcore.api.a.b(Unknown Source:11)  at com.citrix.sdk.appcore.api.a.a(Unknown Source:45)  at com.citrix.sdk.appcore.api.MamSdk.<init>(Unknown Source:10)  at com.citrix.sdk.appcore.api.MamSdk.getInstance(Unknown Source:27)  at com.citrix.mvpn.helper.d.<init>(Unknown Source:5)  at com.citrix.mvpn.helper.b.a(Unknown Source:19)  at com.citrix.mvpn.helper.e.i(Unknown Source:6)  at com.citrix.mvpn.helper.e.a(Unknown Source:10)  at com.citrix.mvpn.api.MicroVPNSDK.startTunnel(Unknown Source:4)  at com.citrix.mvpntestapp.util.VpnUtil.startTunnel(VpnUtil.java:18)  at com.citrix.mvpntestapp.activities.StartTunnelAndSendNetworkRequestActivity.onCreate(StartTunnelAndSendNetworkRequestActivity.java:59)  at android.app.Activity.performCreate(Activity.java:8282)  at android.app.Activity.performCreate(Activity.java:8262)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1335)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4005)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4197)  at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)  at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)  at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2434)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loopOnce(Looper.java:226)  at android.os.Looper.loop(Looper.java:313)  at android.app.ActivityThread.main(ActivityThread.java:8633)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) 

xingliangt commented 2 years ago

work round for mamsdk 22.5.0:

api (group: 'com.citrix.android', name: 'authmanagerlitelib', version: "Release_22.5.0-+", ext: "aar", classifier: "release", transitive: 'true')

Add this dependency to your app build.gradle

we will fix it on mamsdk 22.9.0

choutman commented 2 years ago

Thank you for your quick response. I applied the suggested workaround to my test repository. Unfortunately, this results in build errors which prevents me from running the app. The build fails with the following error:

Apps targeting Android 12 and higher are required to specify an explicit value forandroid:exportedwhen the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

When do you plan to release 22.9.0? And will it be available in the expected repositories (please see https://github.com/citrix/citrix-mam-sdks/issues/69, https://github.com/citrix/citrix-mam-sdks/issues/66, https://github.com/citrix/citrix-mam-sdks/issues/60)?

xingliangt commented 2 years ago

Hi mamsdk 22.9.0 is published in github maven.this version will solve your problem

thank you!

choutman commented 2 years ago

Thank you for the update. I am happy to confirm that the sample app compiles without errors.