How to add Google Admob mediation in Flutter apps? - Stack Overflow

According to the official documentation, I've implemented all the code in my Flutter project. I wa

According to the official documentation, I've implemented all the code in my Flutter project. I want to add Unity Ads as a partner network, which is why I also added the gma_mediation_unity package locally to my project. I was verifying whether the mediation was successfully implemented by doing it this way

  MobileAds.instance.initialize().then((initializationStatus) {

     initializationStatus.adapterStatuses.forEach((key, value) {
     debugPrint('\n\n Mobile Adapter status for $key: ${value.description} \n\n');
   });
});

If it's prints Unity Adapter like this, I'm assume it's has been implemented correctly.

Mobile Adapter status for com.google.ads.mediation.unity.UnityAdapter:

But It's only printing this, which is coming from google_mobile_ads package. :

Mobile Adapter status for com.google.android.gms.ads.MobileAds:

and then I also looks at the example project of gma_mediation_unity package. ensure's that I have implemented them correctly, but it doesn't initialize any adapter for Unity. Whats the issue here? If anyone have ever tried to implement admob mediation, feel free to help me.

settings.gradle:

pluginManagement {
def flutterSdkPath = {
    def properties = new Properties()
    file("local.properties").withInputStream { properties.load(it) }
    def flutterSdkPath = properties.getProperty("flutter.sdk")
    assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
    return flutterSdkPath
}()

repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
}


}

plugins {
  id "dev.flutter.flutter-plugin-loader" version "1.0.0"
  id "com.android.application" version "8.1.0" apply false
  id ".jetbrains.kotlin.android" version "1.8.22" apply false
  id "com.google.gms.google-services" version "4.3.15" apply false
}

include ":app"

android/build.gradle:

buildscript {
    ext.kotlin_version = '2.0.21'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath ".jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}


allprojects {
    repositories {
        google()
        mavenCentral()
    }

}

rootProject.buildDir = "../build"
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

in the last line of android/app/build.gradle:

dependencies {
    implementation("com.google.android.gms:play-services-ads:23.6.0")
    implementation("com.unity3d.ads:unity-ads:4.13.1")
    implementation("com.google.ads.mediation:unity:4.13.1.0")
}

Flutter Version: 3.27.3

Gradle Version: 8.5

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744925557a4601412.html

相关推荐

  • How to add Google Admob mediation in Flutter apps? - Stack Overflow

    According to the official documentation, I've implemented all the code in my Flutter project. I wa

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信