microsoftconnect / ms-intune-app-sdk-android

Intune App SDK for Android enables data protection features and mobile app management via Microsoft Intune
45 stars 18 forks source link

Mamification fails when using react-native-vision-camera on Android #153

Closed nickplucker closed 9 months ago

nickplucker commented 1 year ago

Describe the bug: We use react-native-vision-camera along with vision-camera-code-scanner to scan barcodes. Our Android builds use the integrated Intune SDK and we get the following error on the transformClassesWithMamifyTransformForDebug task:

Execution failed for task ':app:transformClassesWithMamifyTransformForDebug'.
> class com.google.android.gms.common.api.internal.GoogleApiManager$zaa can not implement com.google.android.gms.common.api.internal.zar, because it is not an interface (com.google.android.gms.common.api.internal.zar is in unnamed module of loader javassist

Our builds work fine without the Intune SDK, which is the reason for making this issue here.

To Reproduce Install the latest of react-native-vision-camera along with vision-camera-code-scanner on any React Native project with the Intune SDK.

Notable libraries used:

Expected behavior: Android builds to succeed.

Screenshots and logs:

Execution failed for task ':app:transformClassesWithMamifyTransformForDebug'.
> class com.google.android.gms.common.api.internal.GoogleApiManager$zaa can not implement com.google.android.gms.common.api.internal.zar, because it is not an interface (com.google.android.gms.common.api.internal.zar is in unnamed module of loader javassist

Smartphone (please complete the following information): Any Android phone

Intune App SDK for Android (please complete the following information):

Additional context: I'm sure there's some sort of dependency conflict, but can't pinpoint where. I've tried changing the versions of quite a few libraries, but always end up with the same error.

ianbby commented 1 year ago

Hi Intune team, adding additional context here -- this error is only present when we have verify=true in the intunemam gradle settings block. (re: https://learn.microsoft.com/en-us/mem/intune/developer/app-sdk-android-phase3#verification )

Is verification error a risk?

mcsimons commented 1 year ago

Hi @nickplucker has this task ever worked? i.e. with an older Intune SDK or older releases of react-native-vision-camera or vision-camera-code-scanner? Or are these new additions to your application?

nickplucker commented 1 year ago

Hi @mcsimons, This is a new addition to our application, however we just recently transitioned from Intune wrapping to using the SDK.

Those two packages work with Intune wrapping and the SDK (if we turn verification off). As @ianbby mentioned, we only get this error with the verification task.

I've tried different versions of the SDK and vision-camera, but always get the same error.

As a workaround, we can disable verification, however, is this approach discouraged?

bannus commented 1 year ago

Hi @nickplucker, sorry for the delayed response here. Continuing with verification disabled is discouraged, as the verification failure indicates that an issue may occur when this class is used at runtime. We will try to reproduce on our end -- if you have a minimal sample app that can reproduce the issue, please share it here to aid our investigation.

(Internal tracking: #21257934)
codylund commented 1 year ago

Unfortunately, I'm not having much luck with a local repro, so I think a minimal sample project could be helpful here.

I will say, I'm not immediately convinced that this is specific to React or the react-native-vision-camera and vision-camera-code-scanner libraries, because the conflicting classes appear to originate from the Google Play Services libraries. I agree with the original assessment that there may be some version dependency conflicts in the Play Services dependencies. @nickplucker, are you able to provide any additional context on how Google Play Services are configured for your application? I'd be particularly interested to see the corresponding Gradle logic.

With no certainty, you may also have success using the preview version of our plug-in, available in v9.4.0 of the MAM SDK, as documented here. The preview version does not utilize the now-deprecated Gradle transform APIs, which could be at play here.

bannus commented 9 months ago

Closing due to lack of response. Will re-open if more details are provided.