Search code examples
c#mauigoogle-play-consoleandroid-app-bundle

Google pay version 5.2.1 on .Net Maui


I have built a .net maui application. I have updated the manifest to include the code

 <uses-permission android:name="com.android.vending.BILLING" />

I am however getting this error:

enter image description here

I am hoping to add the subscription and in-app purchase system


Solution

  • Thanks to the help of @FreakyAli and @Jason, I researched and found valuable nugget pakages.

    It is the In app billing plugin. This plugin uses some packages that allows for the more update method for andoid billing.

    First I had to delete the code bellow from tha android manifest xml file.

     <uses-permission android:name="com.android.vending.BILLING" />
    

    Then I installed the Plugin.InAppBilling Nugget package. This package will not work off the bat because this package refrences another package that actually solves the problem.

    This package is, Xamarin.Android.Google.BillingClient. You can find a simple documentation here

    After which I had to add the following code in the project config file.

     <ItemGroup Condition="('$(TargetFramework)' == 'net8.0-android')">
         <PackageReference Include="Xamarin.AndroidX.Collection" 
               Version="1.3.0.2" />
         <PackageReference Include="Xamarin.AndroidX.Preference" 
                Version="1.2.1.3" />
     </ItemGroup>
    

    This is to metigate an error that will come up that says:

    Type androidx.collection.ArrayMapKt is defined multiple times: [path]... [path]