Kebechet/Maui.RevenueCat.InAppBilling

Android Xamarin.Google.Crypto.Tink.Android downgrade error

Closed this issue · 6 comments

When adding the latest version (1.1.1) there is now a requirement for Xamarin.Google.Crypto.Tink.Android 1.8.0.1 or greater. The current release of MAUI (.net7.0-android33) locks the version of Xamarin.Google.Crypto.Tink.Android to 1.7.0.1 causing this nuget package to fail to install.

The workaround for this is to add an explicit reference forcing it to version 1.8.0.1 I've added the following into my csproj file:

	<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android33.0'">
		<PackageReference Include="Xamarin.Google.Crypto.Tink.Android">
			<Version>1.8.0.1</Version>
		</PackageReference>
	</ItemGroup>

I think that from .NET8 these MAUI dependencies wont be baked into the sdk itself but they will be provided in form of nuget packages. So it should be easier to resolve these things.

Android RevenueCat for some reason use the newer version of Tink.Android, so I had to force version override.
Currently in .NET MAUI are similar tickets:
dotnet/maui#12953 (comment)
dotnet/maui#16244

After we migrate to .NET8 we can reevaluate all these workarounds needed for this package to work and hopefully simplify the whole flow.

@CameronVetter what are your current workarounds to make this package work ?

  1. Overriding Tink.Android
<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
    <PackageReference Include="Xamarin.Google.Crypto.Tink.Android" VersionOverride="1.8.0.1" />
</ItemGroup>
  1. anything else ?

so I can put it into readme until this is somehow fixed

Yes I think this is a reasonable way to close this, I'm curious why you haven't run into this yourself in your project...
Anyway combining #1 and this issue together the workarounds I'm adding the following:

	<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android33.0'">
		<PackageReference Include="Xamarin.AndroidX.Activity.Ktx">
			<Version>1.7.2</Version>
		</PackageReference>
	</ItemGroup>

	<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android33.0'">
		<PackageReference Include="Xamarin.GooglePlayServices.Base">
        <Version>118.2.0.2</Version>
      </PackageReference>
    </ItemGroup>

	<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android33.0'">
		<PackageReference Include="Xamarin.Google.Crypto.Tink.Android">
			<Version>1.8.0.1</Version>
		</PackageReference>
	</ItemGroup>

I would think this could be generalized to:

<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
    <PackageReference Include="Xamarin.Google.Crypto.Tink.Android" VersionOverride="1.8.0.1" />    
    <PackageReference Include="Xamarin.AndroidX.Activity.Ktx" VersionOverride="1.7.2" />
    <PackageReference Include="Xamarin.GooglePlayServices.Base" VersionOverride="118.2.0.2" />
</ItemGroup>

I have tried the workarounds mentioned above but get the following errors:

1>Xamarin.Android.Common.targets(432,3): Error XA0121 : Assembly 'Xamarin.Android.Support.v4' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.
1>Xamarin.Android.Common.targets(432,3): Error XA0121 : Assembly 'Xamarin.Android.Support.v4' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.
1>Xamarin.Android.Common.targets(432,3): Error XA0121 : Assembly 'Xamarin.Android.Support.v4' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.
1>Xamarin.Android.Common.targets(432,3): Error XA0121 : Assembly 'Xamarin.GooglePlayServices.Base' is using '[assembly: Java.Interop.JavaLibraryReferenceAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.
1>Xamarin.Android.Common.targets(432,3): Error XA0121 : Assembly 'Xamarin.GooglePlayServices.Base' is using '[assembly: Android.IncludeAndroidResourcesFromAttribute]', which is no longer supported. Use a newer version of this NuGet package or notify the library author.

Seems to work if I use Version instead of VersionOverride.

thanks @varyamereon the Version works. So final condition looks like:

<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
	<PackageReference Include="Xamarin.Google.Crypto.Tink.Android" VersionOverride="1.8.0.1" />
	<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version ="1.7.2" />
	<PackageReference Include="Xamarin.GooglePlayServices.Base" Version ="118.2.0.2" />
</ItemGroup>

I have added this into README.md

It is quite weird that my main app doesnt experience these problems, probably I have imported other libraries that import these under the hood. But in new clean project this error immediately appears.

Resolved in #27