我目前正在使用Google Admob在我的应用中展示广告,我想添加中介,因为我对填充率不满意。
我按照网站上的步骤进行了通过中介整合Adcolony的步骤。
我添加了adcolony.jar文件,并使用Android Studio将其与Gradle同步。
在集成过程中,我在应用程序级别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'
}
...

运行我的应用程序后,调试控制台将引发以下错误:
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

我已经缩短了错误,但主要是与发现的重复类有关,我不知道如何在build.gradle中排除这么多类。请帮忙。

最佳答案

要集成广告中介,您需要按照网站上提到的所有步骤操作,而不是使用build.gradle,而是从adcolony存储库中手动添加了适配器。
Google Admob中介网站已过时,请使用此链接查看如何集成广告适配器。

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

10-06 01:00