firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
223 stars 37 forks source link

[Bug] Unity 6000, Conflicts with AdMob (Unity LevelPlay) #1127

Open lordnedox opened 1 day ago

lordnedox commented 1 day ago

Description

Hi, I'm getting an error when building the app for Android, using Unity 6000.0.23f1 (LTS). The error occurs when using Firebase Analytics in combination with LevelPlay with AdMob enabled.

I've used this same combination with previous version of Unity with no issue (2022.3 worked fine). The error only occurs with the latest version 6000, which is not LTS and the recommeded version to use.

The error is: Attribute property#android.adservices.AD_SERVICES_CONFIG@resource value=(@xml/ga_ad_services_config) from [com.google.android.gms:play-services-measurement-api:22.1.0] AndroidManifest.xml:32:13-58 is also present at [com.google.android.gms:play-services-ads-lite:23.4.0] AndroidManifest.xml:109:13-59 value=(@xml/gma_ad_services_config). Suggestion: add 'tools:replace="android:resource"' to element at AndroidManifest.xml to override.

I am using latest versions of LevelPlay/AdMob and Firebase Analytics.

I tried adding <property android:name="android.adservices.AD_SERVICES_CONFIG" android:resource="@xml/gma_ad_services_config" tools:replace="android:resource" />

to the manifest template, but it didn't work, and anyways doesn't seem to be an elegant solution.

Any suggestion?

Reproducing the issue

  1. Create a new project with Unity 6000.0.23f1
  2. Import Firebase Analytics unity package
  3. Import LevelPlay from the Package manager
  4. In Mediation configuration, enable AdMob
  5. Build the project for Android

Firebase Unity SDK Version

12.3.0

Unity editor version

6000.0.23f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

Analytics

Other Firebase Component(s) in use

No response

Additional SDKs you are using

LevelPlay / AdMob

Targeted Platform(s)

Android

Unity editor platform

Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

Relevant Log Output

GRADLE ERROR : colliding-attributes
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

> Task :launcher:processReleaseMainManifest FAILED
[com.google.firebase:firebase-analytics-unity:12.2.1] 
Warning: Namespace 'com.google.firebase.unity.analytics' is used in multiple modules and/or libraries: 
    com.google.firebase:firebase-analytics-unity:12.2.1, :firebase-analytics-unity-12.2.1:. 
    Please ensure that all modules and libraries have a unique namespace. 
For more information, See https://developer.android.com/studio/build/configure-app-module#set-namespace
See https://developer.android.com/r/studio-ui/build/manifest-merger for more information about the manifest merger.

Attribute property#android.adservices.AD_SERVICES_CONFIG@resource value=(@xml/ga_ad_services_config) 
    from [com.google.android.gms:play-services-measurement-api:22.1.0] AndroidManifest.xml:32:13-58
    is also present at [com.google.android.gms:play-services-ads-lite:23.4.0] AndroidManifest.xml:109:13-59 value=(@xml/gma_ad_services_config).
    Suggestion: add 'tools:replace="android:resource"' to <property> element at AndroidManifest.xml to override.

If using CocoaPods for Apple platforms, the project's Podfile.lock

Expand Podfile.lock snippet
```yml 👀 Replace this line with the contents of your Podfile.lock! ```
google-oss-bot commented 1 day ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

damozhang commented 21 hours ago

Same.

After editing AndroidManifest.xml, the project built successfully.

`

`