microsoftconnect/ms-intune-app-sdk-android

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

v-npadhy opened this issue · 8 comments

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

  • **Microsoft.Intune.Maui.Essentials.android Version:10.0.0
  • Operating System (Mac, Linux, Windows) and Version: Mac Sonoma 14.4.1
  • Visual Studio Version: 17.6.10 (build 428)

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

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

/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.

@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 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.

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

@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.

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

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.