Search Unity

[Solved] Gradle is not building after importing facebook SDK with admob mediation

Discussion in 'Unity Ads & User Acquisition' started by WaqasGameDev, Apr 30, 2021.

Thread Status:
Not open for further replies.
  1. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    Hi, this is not a question but a solution I found after days of hit and trial and I want to share with the people suffering the same problem. I was trying to implement Facebook ads with admob mediation and when I imported facebook ads and ran External dependency Manager(Android Resolver) in unity, the gradle failed to build. I detected it was facebook ads causing problem because when I removed facebook adapter, the gradle was building. So below is a detail what was causing the issue and how did I solved. Some of my information might be wrong in theory but this is what is working.

    Admob SDKs use "Google Play Services version 19.5.0" (Because this is what being resolved when I use Android Resolver) so corresponding "Google Mediation Facebook Ads adapter version was 3.1.0 which Fetches Facebook Audience Network 6.2.0 and Google Mediation adapter 6.2.0.0 Library from MAVEN REPOSITORY.

    But when we tried to resolve dependencies using External Dependency Manager to fetch FAN 6.2.0, instead it fetched the latest version i.e. i think 6.3.1 or so. That new FAN version also replaced "Google Play Services version 19.5.0" with "Google Play Services version 20.0.0" and Unity does not support this "Google Play Services version". So end result was we needed FAN 6.2.0 with same "Google Play Services version 19.5.0" but Unity was fetching FAN 6.3.1 with wrong GPS version.

    So instead of using Unity's External Dependency Manager to fetch the right FAN version, I read path and download correct FAN versions manually. And it worked.

    I used this website. This is Maven Repository.
    https://mvnrepository.com/

    And I downloaded right version for Audience Network SDK from this link
    https://mvnrepository.com/artifact/com.facebook.android/audience-network-sdk

    And right version for Google Facebook Mediation using this address
    https://mvnrepository.com/artifact/...ok?repo=bt-google-mobile-ads-adapters-android

    Then placed those two .aar files in ASSETS -> PLUGINS -> ANDROID folder.

    Then I Resolved dependencies using External Dependencies Manager and it resolved correctly.

    Now question is from where I came to know what files should I download from Maven? Here is the way.

    For open bidding this is what google suggest.
    Ref : Image 1
    at this link, https://developers.google.com/admob/unity/mediation/facebook

    When we scroll down this link, there is a Changelog. Where it is shown what version of Google Adapter related to what version of Facebook SDKs. So clicking on these blue links, I checked which Facebook SDKs uses Google Mobile Ads SDK version.
    Ref : Image 2

    So here I came to know 19.5.0 is compatible with these 2 Facebook SDKs i.e. 6.2.0 and 6.2.0.0. Now I needed their path
    Ref : Image 3

    https://bintray.com/google/mobile-ads-adapters-android/com.google.ads.mediation.facebook/6.2.0.0#files/com/google/ads/mediation/facebook/6.2.0.0
    That path I got from this highlighted file from this link.
    Ref : Image 4

    and here was the path. So I used these paths on maven to get correct libraries manually and it worked.
    Ref : Image 5
     

    Attached Files:

Thread Status:
Not open for further replies.