marcojak / MauiMTAdmob

MIT License
109 stars 18 forks source link

Conflicts during installation #83

Closed CostasAthan closed 2 months ago

CostasAthan commented 2 months ago

While trying to install MauiMTAdmob NuGet package, I get the following conflicts:

Error NU1107

Version conflict detected for Xamarin.AndroidX.Collection.Jvm. Install/reference Xamarin.AndroidX.Collection.Jvm 1.4.0.4 directly to project MyApp to resolve this issue.

MyApp -> Xamarin.Google.UserMessagingPlatform 2.2.0.2 -> Xamarin.GooglePlayServices.Basement 118.3.0.2 -> Xamarin.AndroidX.Collection 1.4.0.5 -> Xamarin.AndroidX.Collection.Jvm (>= 1.4.0.4)

MyApp -> Plugin.MauiMTAdmob 1.4.5 -> Xamarin.AndroidX.Collection.Ktx 1.3.0.2 -> Xamarin.AndroidX.Collection.Jvm (>= 1.3.0.2 && < 1.3.1).

The AndroidX packages are dependencies.

Xamarin.Google.UserMessagingPlatform is a package needed for showing the Google CMP message and its installation can not be avoided.

marcojak commented 2 months ago

Hi.

Check the versions installed in the sample (there are both .net and 7 and .net 8 versions).

It will tell you which version to use to solve this.

CostasAthan commented 2 months ago

Hello!

Easier said than done...

Just tried to downgrade Xamarin.Google.UserMessagingPlatform to 2.2.0.1 and that led to knew conflicts...

Error NU1605

Warning As Error: Detected package downgrade: Xamarin.Google.UserMessagingPlatform from 2.2.0.2 to 2.2.0.1. Reference the package directly from the project to select a different version.

MyApp -> Xamarin.GooglePlayServices.Ads 122.3.0.5 -> Xamarin.GooglePlayServices.Ads.Lite 122.3.0.5 -> Xamarin.Google.UserMessagingPlatform (>= 2.2.0.2)

MyApp -> Xamarin.Google.UserMessagingPlatform (>= 2.2.0.1)

marcojak commented 2 months ago

Try this:

    <ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
            <PackageReference Include="Xamarin.GooglePlayServices.Ads.Lite" Version="122.3.0.4" />
            <PackageReference Include="Xamarin.Google.UserMessagingPlatform" Version="2.2.0.1" />
            <PackageReference Include="Xamarin.AndroidX.Collection" Version="1.3.0.2" />
            <PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.3.0.2" />
    </ItemGroup>
CostasAthan commented 2 months ago

No luck! I had already tried adding <PackageReference Include="Xamarin.Google.UserMessagingPlatform" Version="2.2.0.1" />

The same error persists.

marcojak commented 2 months ago

Could you copy the android csproj section of your project?

Also just in case, clean your solution and remove the bin and obj folders

On Sun, 14 Jul 2024, 10:47 CostasAthan, @.***> wrote:

No luck! I had already tried adding <PackageReference Include="Xamarin.Google.UserMessagingPlatform" Version="2.2.0.1" />

The same error https://github.com/marcojak/MauiMTAdmob/issues/83#issuecomment-2227282110 persists.

— Reply to this email directly, view it on GitHub https://github.com/marcojak/MauiMTAdmob/issues/83#issuecomment-2227284783, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUIPIWWXTWO4IUOD5KHGATZMJCM3AVCNFSM6AAAAABK3AXGO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGI4DINZYGM . You are receiving this because you commented.Message ID: @.***>

CostasAthan commented 2 months ago

I had already tried cleaning the solution, but it didn't solve the problem. I also now deleted obj and bin directories following your suggestion and I rebuilt the project. Same error continues to appear.

Here is the relevant code from the .csproj file:

    <ItemGroup>
       <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
       <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
       <PackageReference Include="Plugin.StoreReview" Version="6.2.0" />
       <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.70" />
       <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.70" />
       <PackageReference Include="Microsoft.NET.ILLink.Tasks" Version="8.0.7" />
       <PackageReference Include="Xamarin.Google.UserMessagingPlatform" Version="2.2.0.1" />
    </ItemGroup>

    <ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
            <PackageReference Include="Xamarin.GooglePlayServices.Ads.Lite" Version="122.3.0.4" />
            <PackageReference Include="Xamarin.Google.UserMessagingPlatform" Version="2.2.0.1" />
            <PackageReference Include="Xamarin.AndroidX.Collection" Version="1.3.0.2" />
            <PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.3.0.2" />
        </ItemGroup>

        <ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android34.0'">
         <PackageReference Include="Xamarin.GooglePlayServices.Ads">
         <Version>122.3.0.5</Version>
         </PackageReference>
         </ItemGroup>
marcojak commented 2 months ago

Remove this part:

122.3.0.5

If I remember I had the same issues using the latest version of the ads.lite. For now use version 0.4

On Sun, 14 Jul 2024, 10:59 CostasAthan, @.***> wrote:

I had already tried cleaning the solution, but it didn't solve the problem. I also now deleted obj and bin directories following your suggestion and I rebuilt the project. Same error continues to appear.

Here is the relevant code from the .csproj file:

    <ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android34.0'">
   <PackageReference Include="Xamarin.GooglePlayServices.Ads">
   <Version>122.3.0.5</Version>
   </PackageReference>
     </ItemGroup>

— Reply to this email directly, view it on GitHub https://github.com/marcojak/MauiMTAdmob/issues/83#issuecomment-2227287364, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUIPIUJEW27UEI5WGSYMSDZMJDZXAVCNFSM6AAAAABK3AXGO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGI4DOMZWGQ . You are receiving this because you commented.Message ID: @.***>

CostasAthan commented 2 months ago

Version 0.4 of what?

marcojak commented 2 months ago

<PackageReference Include="Xamarin.GooglePlayServices.Ads.Lite" Version="122.3.0.4" />

On Sun, 14 Jul 2024, 11:14 CostasAthan, @.***> wrote:

Version 0.4 of what?

— Reply to this email directly, view it on GitHub https://github.com/marcojak/MauiMTAdmob/issues/83#issuecomment-2227291866, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUIPIS4XIPFVSOGISGKPRDZMJFRJAVCNFSM6AAAAABK3AXGO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGI4TCOBWGY . You are receiving this because you commented.Message ID: @.***>

CostasAthan commented 2 months ago

OK! It actually did work. Thanks for your support!