3

I am currently using Google Admob to display ads in my app, I want to add mediation as I am unhappy with my fill rate. I followed the steps to integrate Adcolony through mediation by following their steps on the website. I added the adcolony.jar file and synced it with Gradle using Android Studio. During the process of integration I added these lines in my app level build.gradle,

repositories {
    jcenter()

    maven {
      url  "https://adcolony.bintray.com/AdColony"
    }
}

...
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.google.android.gms:play-services-ads:19.0.0'
    implementation 'com.google.ads.mediation:adcolony:4.1.3.1'
}
...

After I run my app, the debug console throws these errors:

Duplicate class com.iab.omid.library.adcolony.walking.a.e found in modules jetified-adcolony.jar (adcolony.jar) and jetified-sdk-4.1.3-runtime.jar (com.adcolony:sdk:4.1.3)
  Duplicate class com.iab.omid.library.adcolony.walking.a.f found in modules jetified-adcolony.jar (adcolony.jar) and jetified-sdk-4.1.3-runtime.jar (com.adcolony:sdk:4.1.3)
  Duplicate class com.iab.omid.library.adcolony.walking.b found in modules jetified-adcolony.jar (adcolony.jar) and jetified-sdk-4.1.3-runtime.jar (com.adcolony:sdk:4.1.3)
  Duplicate class com.iab.omid.library.adcolony.walking.c found in modules jetified-adcolony.jar (adcolony.jar) and jetified-sdk-4.1.3-runtime.jar (com.adcolony:sdk:4.1.3)

  Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 51s
Gradle task assembleDebug failed with exit code 1

I have shortened my errors, but mainly they are to do with duplicate classes found, I don't know how to exclude so many classes in my build.gradle. Please help.

Arnav
  • 1,404
  • 2
  • 19
  • 38
  • Did you able to resolve the issue? I am struggling with the same case - how to integrate AdColony with Mediation in Flutter – Angel Todorov Mar 18 '20 at 09:46
  • Hi, yes I solved the issue, I added an answer, let me know if you found it helpful! Thanks. – Arnav Mar 18 '20 at 11:38

1 Answers1

2

To integrate ad mediation, you need follow all the steps mentioned on the website but rather than using build.gradle I manually added the adapter from the adcolony repo. The Google Admob Mediation website is outdated, use this link to see how to integrate the ad adapter.

https://github.com/AdColony/AdColony-Android-SDK/wiki/Project-Setup

Arnav
  • 1,404
  • 2
  • 19
  • 38
  • Thanks man, it seems this will do the trick. One question though - the `build.gradle` file, mentioned in the AdColony documentation is that the `app/build.gradle` or the upper level one? – Angel Todorov Mar 18 '20 at 11:55
  • 1
    You're welcome :) everything is a part of the app level build.gradle – Arnav Mar 18 '20 at 12:17
  • @ArnavVaryani which admob plugin you have used in flutter? Does mediation even depends on admob flutter plugin? In google admob mediation tutorial, they have mentioned about adapters also. Have you used one? – vijay053 Apr 23 '20 at 05:40
  • 1
    @vijay053 yes, you have to use adapters for the specific ad network you want to use. I am using https://pub.dev/packages/flutter_google_ad_manager, its the best dependency I've come across. – Arnav Apr 23 '20 at 10:42
  • @ArnavVaryani Question: In my flutter app admob is working fine using admob_flutter plugin. Now I want to add facebook audience with admob mediation. I have followed the steps provided by google to setup audience account and integration in Admob portal. My confusion is about audience sdk. Which one should I add : 1. facebook_audience flutter plugin - https://pub.dev/packages/facebook_audience_network 2. implementation 'com.google.ads.mediation:facebook:5.8.0.0' - google tutorial 3. implementation 'com.facebook.android:audience-network-sdk:5.+' - facebook sdk integration guide? – vijay053 Apr 25 '20 at 14:15
  • Hey @vijay053, can you open a new question? I'll post a proper solution for it. – Arnav Apr 25 '20 at 14:25
  • @ArnavVaryani I have posted following question for this: https://stackoverflow.com/questions/61427424/in-flutter-how-to-integrate-facebook-audience-as-mediation-network-with-admob Thanks – vijay053 Apr 25 '20 at 14:44