3

我目前正在使用 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 中排除这么多类。请帮忙。

4

1 回答 1

2

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

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

于 2020-03-18T11:38:21.043 回答