googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.34k stars 1.09k forks source link

Cannot change resolution strategy of dependency configuration ':unityLibrary:aarArtifacts' after it has been resolved. #3090

Closed 2345678910JQKA closed 3 months ago

2345678910JQKA commented 6 months ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

Relevant Code:


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':unityLibrary'.
> Cannot change resolution strategy of dependency configuration ':unityLibrary:aarArtifacts' after it has been resolved.
NVentimiglia commented 5 months ago

Hi @2345678910JQKA

This is essentially a Gradle issue and can be solved with configuration.

  1. How are you building the application, is this a Gradle build or a Unity build.
  2. Are you using Gradle or EDM4U dependency resolution
  3. What version of gradle are you using
2345678910JQKA commented 5 months ago

gradle 7.2

2345678910JQKA commented 5 months ago

After deleting the "bee" file in the "library" folder, I was able to successfully package it and the playback of advertisements worked. However, I'm not sure why this happened.

sametguzeldev commented 5 months ago

This issue still happens to me if I have jetifier enabled in my gradle properties. When I remove these two lines I can get a build. Is there a way to make it happen with these settings applied to gradle.properties file? With keeping the current gradle that comes with Unity 2019 (Gradle 6.1.1) and with Gradle build tools version 4.0.1?

android.useAndroidX=true
android.enableJetifier=true
sametguzeldev commented 5 months ago

@NVentimiglia Hey! Is it possible to use an older sdk for ads library like 22.2.0 maybe? Currently I see 22.6.0 is required for ump 2.1 version. 'com.google.android.gms:play-services-ads:22.6.0'

I can get a success build with older version and from my testing, it seems like UMP works as well but I just wanted to confirm it.

NVentimiglia commented 5 months ago

@sametguzeldev , @2345678910JQKA

I was unable to replicate this issue on Unity 2021.3 / Plugin 8.6 / Api level 34. I recommend uninstalling and reinstalling the plugin and clearing your android gradle cache.

kshkulev commented 4 months ago

Unity 2021.3.29 / Plugin 8.7.0 / API 33-34 and internal Gradle still fails. None of the workarounds help solve the issue.

NVentimiglia commented 3 months ago

@kshkulev have yo tried using a Custom Base Gradle Template ?

kshkulev commented 3 months ago

@NVentimiglia yup, it didn't help. But after upgrading plugin to 9.0.0 I can now build successfully.

NVentimiglia commented 3 months ago

Great, Glad it is working now.