jamesmontemagno / InAppBillingPlugin

Cross-platform In App Billing Plugin for .NET
MIT License
651 stars 152 forks source link

v4 has a requirement >1.3.1 Xamarin.Essentials? #364

Closed Meekohi closed 3 years ago

Meekohi commented 3 years ago

Trying to upgrade to v4.0, but getting

Severity    Code    Description Project File    Line    Suppression State
Error       Mono.Linker.MarkException: Error processing method: 'Android.App.Activity Plugin.InAppBilling.InAppBillingImplementation::get_Activity()' in assembly: 'Plugin.InAppBilling.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve Android.App.Activity Xamarin.Essentials.Platform::get_CurrentActivity()
   at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
   at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
   at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
   at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   --- End of inner exception stack trace ---
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
   at Xamarin.Android.Tasks.AndroidTask.Execute()   HarmonyHelper.App.Android           

Docs recommend doing

            var context = Xamarin.Essentials.Platform.AppContext;
            var activity = Xamarin.Essentials.Platform.CurrentActivity;

This is invalid in Xamarin.Essentials 1.3.1, I updated to 1.6.1 and am still getting the same error but at least the above code is valid. Seems like there are some unwritten prerequisites that need to be included in the docs.

Meekohi commented 3 years ago

Good ol' Xamarin... randomly reinstalling nuget packages, cleaning, and relaunching five or six times fixed the error... so the only issue is updating docs to clarify which version of Xamarin.Essentials is required.

jamesmontemagno commented 3 years ago

Updated docs :)

Meekohi commented 3 years ago

Thanks!

On Tue, Mar 9, 2021 at 5:17 PM James Montemagno notifications@github.com wrote:

Closed #364 https://github.com/jamesmontemagno/InAppBillingPlugin/issues/364.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jamesmontemagno/InAppBillingPlugin/issues/364#event-4431776553, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACV2KPB3PTN4AS6Z7I4ZTTC2F6ZANCNFSM4Y4MDUSQ .