Repository navigation
Closed
Labels
Area: App+Library BuildIssues when building Library projects or Application projects.need-attentionA xamarin-android contributor needs to review
Description
Android application type
.NET Android (net7.0-android, etc.)
Affected platform version
VSMac 17.6.1 (build 452)
Description
MAUI App build error after add this nuget package
DatePickerSampleApp.zip is the code of Forms and MAUI
Other info:
Xamarin.Forms project is fine to build
Steps to Reproduce
1.Unzip the zip file
2.open the mauisampleapp using vs for Mac
3.build the sln,
4.errors show
Did you find any workaround?
no
Relevant log output
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.68/tools/Xamarin.Android.Common.targets(1476,3): warning XA4214: The managed type `Kotlin.IO.Path.IExperimentalPathApi` exists in multiple assemblies: Xamarin.Kotlin.StdLib, Xamarin.Kotlin.StdLib.Jdk7. Please refactor the managed type names in these assemblies so that they are not identical.
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.68/tools/Xamarin.Android.Common.targets(1476,3): warning XA4214: References to the type `Kotlin.IO.Path.IExperimentalPathApi` will refer to `Kotlin.IO.Path.IExperimentalPathApi, Xamarin.Kotlin.StdLib`.
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.68/tools/Xamarin.Android.Common.targets(1476,3): warning XA4214: The managed type `Kotlin.IO.Path.IFileVisitorBuilder` exists in multiple assemblies: Xamarin.Kotlin.StdLib, Xamarin.Kotlin.StdLib.Jdk7. Please refactor the managed type names in these assemblies so that they are not identical.
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.68/tools/Xamarin.Android.Common.targets(1476,3): warning XA4214: References to the type `Kotlin.IO.Path.IFileVisitorBuilder` will refer to `Kotlin.IO.Path.IFileVisitorBuilder, Xamarin.Kotlin.StdLib`.
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.68/tools/Xamarin.Android.Common.targets(1476,3): error XA4215: The Java type `kotlin.io.path.ExperimentalPathApi` is generated by more than one managed type. Please change the [Register] attribute so that the same Java type is not emitted.
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.68/tools/Xamarin.Android.Common.targets(1476,3): error XA4215: `kotlin.io.path.ExperimentalPathApi` generated by: Kotlin.IO.Path.IExperimentalPathApi, Xamarin.Kotlin.StdLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.68/tools/Xamarin.Android.Common.targets(1476,3): error XA4215: `kotlin.io.path.ExperimentalPathApi` generated by: Kotlin.IO.Path.IExperimentalPathApi, Xamarin.Kotlin.StdLib.Jdk7, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.68/tools/Xamarin.Android.Common.targets(1476,3): error XA4215: The Java type `kotlin.io.path.FileVisitorBuilder` is generated by more than one managed type. Please change the [Register] attribute so that the same Java type is not emitted.
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.68/tools/Xamarin.Android.Common.targets(1476,3): error XA4215: `kotlin.io.path.FileVisitorBuilder` generated by: Kotlin.IO.Path.IFileVisitorBuilder, Xamarin.Kotlin.StdLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.68/tools/Xamarin.Android.Common.targets(1476,3): error XA4215: `kotlin.io.path.FileVisitorBuilder` generated by: Kotlin.IO.Path.IFileVisitorBuilder, Xamarin.Kotlin.StdLib.Jdk7, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
4 Warning(s)
6 Error(s)Metadata
Metadata
Assignees
Labels
Area: App+Library BuildIssues when building Library projects or Application projects.need-attentionA xamarin-android contributor needs to review
Activity
jonathanpeppers commentedon Jul 24, 2023
@jpobst @moljac is
kotlin.io.path.ExperimentalPathApione of the types that Google moved around recently?jpobst commentedon Jul 24, 2023
I get a different error locally:
Looking at the
XamarinLibrary.Net.Android.Loper7.DateTimePickerpackage, it would appear to include several AndroidX .aar files in it:Likely these were referenced via a
.jar/.aarinstead of aPackageReference?They should not have been included in the
XamarinLibrary.Net.Android.Loper7.DateTimePickerpackage.moljac commentedon Jul 25, 2023
Not Google, but JetBrains in this case.
Related:
#7699
Workaround for Kotlin errors is to add
Further errors cannot be resolved because of embedded aars (see previous comment #8209 (comment))
jingliancui commentedon Jul 26, 2023
I think there may some issue on binding Or application.
Let me share the binding code later.
microsoft-github-policy-service commentedon Aug 1, 2023
Hi @jingliancui. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
jingliancui commentedon Aug 2, 2023
DateTimePickerBinding.zip
@jpobst please take a look.
after using vs Mac to build it, it will generates 2 aars file as the image you send days ago.
jingliancui commentedon Aug 2, 2023
then you will found that I use Xamarin.Legacy.Sdk/0.2.0-alpha4 in the csproj. so I'm not sure if this sdk will impact the result.
jpobst commentedon Aug 2, 2023
It looks like this may be caused by using a very old version of
Xamarin.Google.Android.Material. Try updating it to a newer version like1.9.0.2.jingliancui commentedon Aug 2, 2023
thanks, will check it later.
In the mean time I have a question, because I reference the dependency base on the native package's reference here:
https://github.com/loper7/DateTimePicker
implementation 'com.google.android.material:material:1.1.0
if we update the dependency to newer version, is it will possible to occur some issue (for example if we are binding other packages instead of this one.)
jpobst commentedon Aug 2, 2023
There is always a possibility of something breaking when updating anything. But even if you were using this library in Java, Maven would use a newer version of Material if another library requested it.
It looks like even that library actually uses a newer version than specified in their readme:
https://github.com/loper7/DateTimePicker/blob/4a1c55986c52bdc27ffd05bfa236371509b87c5e/date_time_picker/build.gradle#L35
jingliancui commentedon Aug 2, 2023
Ha good catch, and I agree with you. Thank you, let me update nuget and test later.
jingliancui commentedon Aug 2, 2023
But then another question, why xamarin application can pass the build.
moljac commentedon Aug 2, 2023
Another suggestion: ask (request from)
loper7/DateTimePickerauthor[s] to update their dependencies too.jpobst commentedon Aug 2, 2023
My guess would be that an XF build uses all "older" dependencies that work well together, while MAUI itself uses "newer" dependencies that are causing this conflict with an "older" Material.
Also, several things about binding projects changed in the transition to .NET 6+, so it could be a change in there that makes things different now.
https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/OneDotNetEmbeddedResources.md
jingliancui commentedon Aug 3, 2023
thanks all, just tested, It work well after update nuget version of com.google.android.material:material