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

[.NET MAUI] Getting build error if multidex is enabled. #223

Closed v-npadhy closed 4 months ago

v-npadhy commented 7 months ago

Intune Android App SDK for .NET MAUI Issue

/Users/niladri/.nuget/packages/microsoft.intune.maui.essentials.android/10.0.0/build/netstandard2.0/Microsoft.Intune.Maui.Essentials.android.targets(9,9): Error: /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.95/tools/android-support-multidex.jar doesn't contain /Users/niladri/.nuget/packages/ and the mamified library won't be placed in the correct intune directory. This is not expected.

Summary

In .NET 7 targeted MAUI, intune package getting build error if multidex is enabled. But in Xamarin Intune package with multidex was working fine.

Details

Logs

Questions to Ask Before Submission

  1. Does the app build and launch without including the Microsoft.Intune.Maui.Essentials.android package?- Yes
  2. Does the issue reproduce if you rebuild after deleting the bin and obj output folders?-Yes
  3. Have you checked the .NET MAUI repository for similar issues? If so, please follow the guidance there or add that information to this issue.- Yes
  4. Are you using the latest Microsoft.Intune.Maui.Essentials.android NuGet package version? Yes
ChismanRaheem commented 7 months ago

Hi @v-npadhy Please gather and upload MSBuild diagnostic log This would help us look into the error message.

v-npadhy commented 7 months ago

/Users/niladri/.nuget/packages/microsoft.intune.maui.essentials.android/10.0.0/build/netstandard2.0/Microsoft.Intune.Maui.Essentials.android.targets(9,9): Error: /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.95/tools/android-support-multidex.jar doesn't contain /Users/niladri/.nuget/packages/ and the mamified library won't be placed in the correct intune directory. This is not expected.

@ChismanRaheem The code is not compiling at all, getting the compilation error.

ChismanRaheem commented 7 months ago

@v-npadhy Could you list the steps taken to replicate this issue and verify whether the packages were installed using NuGet or the Package Manager Console?

v-npadhy commented 7 months ago

@v-npadhy Could you list the steps taken to replicate this issue and verify whether the packages were installed using NuGet or the Package Manager Console?

@ChismanRaheem The Nuget package is getting installed. But code is not compiling.

Initially the solution was built on Xamarin. There we have installed Intune package and also enabled multidex. Now we have migrated to MAUI, and installed MAUI supported Intune package and enabled multidex package.

You can create a empty .NET 7 Android Project, install MAUI Intune package, and enable multidex. You can reproduce the error easily.

ChismanRaheem commented 7 months ago

Hi @v-npadhy Thank you for the update, we are looking into this.

meghandaly commented 6 months ago

@v-npadhy Based on Android documentation, Multidex support for Android 5.0 and higher and Configure your app for multidex:

Note: If your minSdkVersion is set to 21 or higher, multidex is enabled by default and you don't need the multidex library.

And per Supported platforms for .NET MAUI apps, "Android 5.0 (API 21) or higher is required." You may not need to enable multi-dex for your application to work since doing so includes the multi-dex library.

Would you be willing to try and compile your app without multi-dex enabled and report back your findings?

For your awareness, we are also working with the Xamarin.Android team to determine whether this property should apply to MAUI apps at all.

meghandaly commented 6 months ago

@v-npadhy Did you have an opportunity to test without multi-dex enabled?

meghandaly commented 4 months ago

Based on the supported API levels we do not believe this to be relevant for MAUI apps. A future release will ensure this does not fail the build, in the meantime, we suggest customers do not enable multi-dex on their MAUI app.