为了测试 Yandex Ad SDK,我在 Android Studio 中创建了一个新项目
根据他们的文档,我将以下存储库添加到
settings.gradle
:
maven { url "https://android-sdk.is.com/" }
maven { url "https://artifact.bytedance.com/repository/pangle" }
maven { url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea"}
maven { url "https://sdk.tapjoy.com/"}
所以
settings.gradle
内容是:
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url "https://android-sdk.is.com/" }
maven { url "https://artifact.bytedance.com/repository/pangle" }
maven { url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea"}
maven { url "https://sdk.tapjoy.com/"}
}
}
rootProject.name = "My Application"
include ':app'
并添加了
implementation 'com.yandex.android:mobileads-mediation:6.3.0.0'
至
build.gradle
:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.myapplication'
compileSdk 33
defaultConfig {
applicationId "com.example.myapplication"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.yandex.android:mobileads-mediation:6.3.0.0'
}
当我尝试在 Android Studio 中构建项目时,出现以下错误:
FAILURE: Build completed with 9 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:dataBindingMergeDependencyArtifactsDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.appnext.sdk:ads:2.7.1.473.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/appnext/sdk/ads/2.7.1.473/ads-2.7.1.473.pom
- https://repo.maven.apache.org/maven2/com/appnext/sdk/ads/2.7.1.473/ads-2.7.1.473.pom
- https://android-sdk.is.com/com/appnext/sdk/ads/2.7.1.473/ads-2.7.1.473.pom
- https://artifact.bytedance.com/repository/pangle/com/appnext/sdk/ads/2.7.1.473/ads-2.7.1.473.pom
- https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea/com/appnext/sdk/ads/2.7.1.473/ads-2.7.1.473.pom
- https://sdk.tapjoy.com/com/appnext/sdk/ads/2.7.1.473/ads-2.7.1.473.pom
Required by:
project :app > com.yandex.android:mobileads-mediation:6.3.0.0 > com.yandex.ads.mediation:mobileads-appnext:2.7.1.473.0
> Could not find com.appnext.sdk:banners:2.7.1.473.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/appnext/sdk/banners/2.7.1.473/banners-2.7.1.473.pom
- https://repo.maven.apache.org/maven2/com/appnext/sdk/banners/2.7.1.473/banners-2.7.1.473.pom
- https://android-sdk.is.com/com/appnext/sdk/banners/2.7.1.473/banners-2.7.1.473.pom
- https://artifact.bytedance.com/repository/pangle/com/appnext/sdk/banners/2.7.1.473/banners-2.7.1.473.pom
- https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea/com/appnext/sdk/banners/2.7.1.473/banners-2.7.1.473.pom
- https://sdk.tapjoy.com/com/appnext/sdk/banners/2.7.1.473/banners-2.7.1.473.pom
Required by:
project :app > com.yandex.android:mobileads-mediation:6.3.0.0 > com.yandex.ads.mediation:mobileads-appnext:2.7.1.473.0
> Could not find com.appnext.sdk:native-ads2:2.7.1.473.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/appnext/sdk/native-ads2/2.7.1.473/native-ads2-2.7.1.473.pom
- https://repo.maven.apache.org/maven2/com/appnext/sdk/native-ads2/2.7.1.473/native-ads2-2.7.1.473.pom
- https://android-sdk.is.com/com/appnext/sdk/native-ads2/2.7.1.473/native-ads2-2.7.1.473.pom
- https://artifact.bytedance.com/repository/pangle/com/appnext/sdk/native-ads2/2.7.1.473/native-ads2-2.7.1.473.pom
- https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea/com/appnext/sdk/native-ads2/2.7.1.473/native-ads2-2.7.1.473.pom
- https://sdk.tapjoy.com/com/appnext/sdk/native-ads2/2.7.1.473/native-ads2-2.7.1.473.pom
Required by:
project :app > com.yandex.android:mobileads-mediation:6.3.0.0 > com.yandex.ads.mediation:mobileads-appnext:2.7.1.473.0
> Could not find com.chartboost:chartboost-sdk:9.3.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/chartboost/chartboost-sdk/9.3.1/chartboost-sdk-9.3.1.pom
- https://repo.maven.apache.org/maven2/com/chartboost/chartboost-sdk/9.3.1/chartboost-sdk-9.3.1.pom
- https://android-sdk.is.com/com/chartboost/chartboost-sdk/9.3.1/chartboost-sdk-9.3.1.pom
- https://artifact.bytedance.com/repository/pangle/com/chartboost/chartboost-sdk/9.3.1/chartboost-sdk-9.3.1.pom
- https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea/com/chartboost/chartboost-sdk/9.3.1/chartboost-sdk-9.3.1.pom
- https://sdk.tapjoy.com/com/chartboost/chartboost-sdk/9.3.1/chartboost-sdk-9.3.1.pom
...
BUILD FAILED in 31s
21 actionable tasks: 9 executed, 12 up-to-date
这些错误是什么意思?有什么问题吗?可以修复它们吗?
我尝试咨询他们的支持,但他们没有帮助。
根据文档,由于您正在集成Yandex的中介,因此您需要删除在settings.gradle中添加的所有url并将它们添加到应用程序模块的build.gradle文件中。这是他们的集成文档中的步骤 2.4。
Add the following code to the build.gradle file in your app's module:
// IronSource
maven {
url 'https://android-sdk.is.com/'
}
// Pangle
maven {
url 'https://artifact.bytedance.com/repository/pangle'
}
// Tapjoy
maven {
url "https://sdk.tapjoy.com/"
}
// Mintegral
maven {
url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea"
}
// Chartboost
maven {
url "https://cboost.jfrog.io/artifactory/chartboost-ads/"
}
// AppNext
maven {
url "https://dl.appnext.com/"
}
他们还指出:
对于每个适配器,选择最新的兼容版本 自动。