Closed Jricklefs closed 5 months ago
See also: https://github.com/xamarin/AndroidX/issues/764
Applying the following patch to https://github.com/Jricklefs/GPSDontWorkforCasting will allow it to build:
diff --git a/GPSDontWorkforCasting/GPSDontWorkforCasting.csproj b/GPSDontWorkforCasting/GPSDontWorkforCasting.csproj
index 6b39405..279d57b 100644
--- a/GPSDontWorkforCasting/GPSDontWorkforCasting.csproj
+++ b/GPSDontWorkforCasting/GPSDontWorkforCasting.csproj
@@ -66,6 +66,8 @@
<PackageReference Include="Xamarin.GooglePlayServices.Cast.Framework">
<Version>121.3.0.5</Version>
</PackageReference>
+ <PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.4.0" />
+ <PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.4.0" />
</ItemGroup>
</Project>
Consider your error message:
Type androidx.collection.LongSparseArrayKt$keyIterator$1 is defined multiple times: C:\Users\josep.nuget\packages\xamarin.androidx.collection.jvm\1.3.0.2\buildTransitive\net7.0-android33.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/LongSparseArrayKt$keyIterator$1.class, C:\Users\josep.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.9\buildTransitive\net6.0-android31.0....\jar\androidx.collection.collection-ktx.jar:androidx/collection/LongSparseArrayKt$keyIterator$1.class
Within those paths are the package names causing the conflict, after packages\
:
Search for those packages on @(PackageReference)
to use the latest version of those packages. This is what the above patch does, explicitly referencing Xamarin.AndroidX.Collection.Jvm 1.4.0 and Xamarin.AndroidX.Collection.Ktx 1.4.0. This allows the project to build.
Added PR to the repro sample.
It was a bit more than JonP suggested.
<ItemGroup Condition="( '$(TargetFramework)' == 'net8.0-android' )">
<PackageReference Include="Xamarin.AndroidX.Collection" Version="1.4.0" />
<PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.4.0" />
<PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.1.3" />
</ItemGroup>
closing this issue
Xamarin.Android Version (eg: 6.0):
.Net Maui 8
Operating System & Version (eg: Mac OSX 10.11):
Android
Google Play Services Version
Xamarin.GooglePlayServices.Cast.Framework 121.3.0
Describe your Issue
Attempting to implement casting in android does not work. Throws build error.
It will build and deploy when deploying to windows machine but deploying to android cause the error.
The line of code in the example, is showing deprecated, but used to keep the code base minimal. If I use the new method, it causes the same error to be thrown. The only way I can get around the build error is to Roll back the version to 121.2.0.
Relevant information
Add relevant project settings from
*.csproj
file:Packages used:
Build settings (tools)
or even better - links to the existing code:
https://github.com/Jricklefs/GPSDontWorkforCasting
NOTE: Please DO NOT submit screenshot images. Images are not searchable!
Minimal Repro Code Sample
If you want to speed up investigation and bug fixing: please provide minimal repro sample for tests.
Steps to Reproduce (with link to sample solution if possible):
Include any relevant Exception Stack traces, build logs, adb logs:
Exception :