flutterdartadmobadcolonymobile-ad-mediation

Adcolony using Admob mediation not working in Flutter app


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.


Solution

  • 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