Kebechet / Maui.RevenueCat.InAppBilling

MIT License
13 stars 6 forks source link

Android - Nuget package missing dependency on #1

Closed CameronVetter closed 10 months ago

CameronVetter commented 1 year ago

On Android adding this package results in the following errors:

1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\AwaitableResultCallback_1.java(8,36): javac.exe error JAVAC0000:  error: package com.google.android.gms.common.api does not exist
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\AwaitableResultCallback_1.java(8,36): javac.exe error JAVAC0000:       com.google.android.gms.common.api.ResultCallback
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\AwaitableResultCallback_1.java(8,36): javac.exe error JAVAC0000:
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\AwaitableResultCallback_1.java(29,57): javac.exe error JAVAC0000:  error: package com.google.android.gms.common.api does not exist
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\AwaitableResultCallback_1.java(29,57): javac.exe error JAVAC0000:  public void onResult (com.google.android.gms.common.api.Result p0)
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\AwaitableResultCallback_1.java(29,57): javac.exe error JAVAC0000:
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\AwaitableResultCallback_1.java(34,67): javac.exe error JAVAC0000:  error: package com.google.android.gms.common.api does not exist
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\AwaitableResultCallback_1.java(34,67): javac.exe error JAVAC0000:  private native void n_onResult (com.google.android.gms.common.api.Result p0);
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\AwaitableResultCallback_1.java(34,67): javac.exe error JAVAC0000:
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\ResultCallback_1.java(8,36): javac.exe error JAVAC0000:  error: package com.google.android.gms.common.api does not exist
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\ResultCallback_1.java(8,36): javac.exe error JAVAC0000:        com.google.android.gms.common.api.ResultCallback
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\ResultCallback_1.java(8,36): javac.exe error JAVAC0000:
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\ResultCallback_1.java(29,57): javac.exe error JAVAC0000:  error: package com.google.android.gms.common.api does not exist
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\ResultCallback_1.java(29,57): javac.exe error JAVAC0000:   public void onResult (com.google.android.gms.common.api.Result p0)
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\ResultCallback_1.java(29,57): javac.exe error JAVAC0000:
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\ResultCallback_1.java(34,67): javac.exe error JAVAC0000:  error: package com.google.android.gms.common.api does not exist
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\ResultCallback_1.java(34,67): javac.exe error JAVAC0000:   private native void n_onResult (com.google.android.gms.common.api.Result p0);
1>obj\Debug\net7.0-android33.0\android\src\crc6450e07d0e82e86181\ResultCallback_1.java(34,67): javac.exe error JAVAC0000:
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\common\api\internal\BackgroundDetector_BackgroundStateChangeListenerImplementor.java(8,64): javac.exe error JAVAC0000:  error: package com.google.android.gms.common.api.internal.BackgroundDetector does not exist
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\common\api\internal\BackgroundDetector_BackgroundStateChangeListenerImplementor.java(8,64): javac.exe error JAVAC0000:       com.google.android.gms.common.api.internal.BackgroundDetector.BackgroundStateChangeListener
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\common\api\internal\BackgroundDetector_BackgroundStateChangeListenerImplementor.java(8,64): javac.exe error JAVAC0000:
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\dynamic\OnDelegateCreatedListenerImplementor.java(8,33): javac.exe error JAVAC0000:  error: package com.google.android.gms.dynamic does not exist
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\dynamic\OnDelegateCreatedListenerImplementor.java(8,33): javac.exe error JAVAC0000:      com.google.android.gms.dynamic.OnDelegateCreatedListener
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\dynamic\OnDelegateCreatedListenerImplementor.java(8,33): javac.exe error JAVAC0000:
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\dynamic\OnDelegateCreatedListenerImplementor.java(29,63): javac.exe error JAVAC0000:  error: package com.google.android.gms.dynamic does not exist
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\dynamic\OnDelegateCreatedListenerImplementor.java(29,63): javac.exe error JAVAC0000:     public void onDelegateCreated (com.google.android.gms.dynamic.LifecycleDelegate p0)
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\dynamic\OnDelegateCreatedListenerImplementor.java(29,63): javac.exe error JAVAC0000:
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\dynamic\OnDelegateCreatedListenerImplementor.java(34,73): javac.exe error JAVAC0000:  error: package com.google.android.gms.dynamic does not exist
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\dynamic\OnDelegateCreatedListenerImplementor.java(34,73): javac.exe error JAVAC0000:     private native void n_onDelegateCreated (com.google.android.gms.dynamic.LifecycleDelegate p0);
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\dynamic\OnDelegateCreatedListenerImplementor.java(34,73): javac.exe error JAVAC0000:
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\security\ProviderInstaller_ProviderInstallListenerImplementor.java(8,52): javac.exe error JAVAC0000:  error: package com.google.android.gms.security.ProviderInstaller does not exist
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\security\ProviderInstaller_ProviderInstallListenerImplementor.java(8,52): javac.exe error JAVAC0000:         com.google.android.gms.security.ProviderInstaller.ProviderInstallListener
1>obj\Debug\net7.0-android33.0\android\src\mono\com\google\android\gms\security\ProviderInstaller_ProviderInstallListenerImplementor.java(8,52): javac.exe error JAVAC0000:

This is fixed by adding the package Xamarin.GooglePlayServices.Base. I believe this should be a dependency of the nuget package.

CameronVetter commented 1 year ago

I ended up adding these to my csproj to get things working on android:

    <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>
Kebechet commented 1 year ago

interesting, what dotnet version do you have ? put dotnet --version to powershell

and also please share output of: dotnet workload list

CameronVetter commented 1 year ago

My dotnet version is 7.0.306 and my workload list is:

Installed Workload Id      Manifest Version       Installation Source
--------------------------------------------------------------------------------
android                    33.0.68/7.0.100        SDK 7.0.300, VS 17.6.33829.357
ios                        16.4.7089/7.0.100      SDK 7.0.300, VS 17.6.33829.357
maccatalyst                16.4.7089/7.0.100      SDK 7.0.300, VS 17.6.33829.357
maui                       7.0.92/7.0.100         SDK 7.0.300
maui-android               7.0.92/7.0.100         SDK 7.0.300, VS 17.6.33829.357
maui-ios                   7.0.92/7.0.100         SDK 7.0.300, VS 17.6.33829.357
maui-maccatalyst           7.0.92/7.0.100         SDK 7.0.300, VS 17.6.33829.357
maui-windows               7.0.92/7.0.100         SDK 7.0.300, VS 17.6.33829.357
wasm-tools                 7.0.9/7.0.100          SDK 7.0.300, VS 17.6.33829.357
Kebechet commented 1 year ago

I have exactly the same versions,hmm. Your app targets just Android v33 ? Or this error happens just on that device ? because you have there specified net7.0-android33.0 instead of basic: net7.0-android

CameronVetter commented 1 year ago

net7.0-android33.0 is what the project template created and put in for my target. VS2022 has been using that when it adds platform specific as above... I followed the example when I added Xamarin.AndroidX.Activity.Ktx, which is workaround for a bug in the current MAUI release when adding google play.

I think the real fix for this is to add a dependency in the nuspec to these two packages. I would have done a PR, but the nuspec isn't in the repo.

Kebechet commented 1 year ago

can you please post that github issue here ?

CameronVetter commented 1 year ago

can you please post that github issue here ?

https://github.com/xamarin/AndroidX/issues/717

Kebechet commented 1 year ago

Probably it would be better to migrate from Android xamarin package to new MAUI one.

That could theoretically fix the issue without implementing any workarounds.

The whole process should be quite straight-forward. Just replace old nuget with a new one and test if it works correctly. But I am quite busy and I will get to that in a week or two.

So if you have time sooner, you can try it and let me know/create a PR.

Kebechet commented 1 year ago

After this PR is merged, please let me know if this problem still persists

CameronVetter commented 1 year ago

After this PR is merged, please let me know if this problem still persists

No this is not resolved. This issue is caused by the Revenuecat Xamarin bindings referencing newer versions than the MAUI SDK targets. In fact, it is now worse with this newer version of the RevenueCat bindings and I opened up #13

This can still be worked around using the workarounds in this issue and the other. I still think it could be addressed with dependencies in the nuspec when building this package, I have not tried it though.

Kebechet commented 10 months ago

Resolved in #27