googleads / googleads-mobile-flutter

A Flutter plugin for the Google Mobile Ads SDK
Apache License 2.0
344 stars 285 forks source link

[MEDIATION] [AppLovinSdk] There are multiple SDK instances detected and SKD key is cut by 10 chars. #927

Closed StanislawNagorski closed 1 year ago

StanislawNagorski commented 1 year ago

[REQUIRED] Step 1: Describe your environment

[✓] Flutter (Channel stable, 3.7.6, on macOS 14.0 23A344 darwin-arm64, locale pl-PL)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] IntelliJ IDEA Community Edition (version 2023.1.4)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

build.gradle:

dependencies {
    def billing_version = "5.1.0"

    implementation platform('com.google.firebase:firebase-bom:30.2.0')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "androidx.multidex:multidex:2.0.1"
    implementation 'com.google.firebase:firebase-config-ktx'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.android.gms:play-services-ads:22.4.0'
    implementation 'com.google.ads.mediation:applovin:11.11.3.0'
    implementation 'com.google.ads.mediation:facebook:6.16.0.0'
    implementation "com.android.billingclient:billing:$billing_version"
}

pubspec.yaml google_mobile_ads: 3.0.0

Android manifest: After finding this bug I have also added to application tag (but above activity):

<meta-data android:name="applovin.sdk.key"
                           android:value="uCPGm3FkRLQQ95LDCZVAbs3I_C41xHHqTg4ElJyBfNcpSy1fWWq6NuON5TP1lgrDMwR5ENHulugCqisKEgRcZr"/>

[REQUIRED] Step 2: Describe the problem

When initializing AppLoving plugin SDK key is cut by 10 chars.

D/AppLovinInitializer( 2642): Attempting to initialize SDK with SDK Key: uCPGm3FkRLQQ95LDCZVAbs3I_C41xHHqTg4ElJyBfNcpSy1fWWq6NuON5TP1lgrDMwR5ENHulugC
W/Ads     ( 2642): Update ad debug logging enablement as false
W/drawing.lesson( 2642): Accessing hidden method Landroid/text/SpannableStringInternal;->length()I (light greylist, linking)
D/AppLovinSdk( 2642): [AppLovinSdk] 
D/AppLovinSdk( 2642): ========================================
D/AppLovinSdk( 2642): SDK Session Begin
D/AppLovinSdk( 2642): ========================================
E/AppLovinSdk( 2642): [AppLovinSdk] Please double-check that you entered your SDK key correctly (uCPGm3FkRLQQ95LDCZVAbs3I_C41xHHqTg4ElJyBfNcpSy1fWWq6NuON5TP1lgrDMwR5ENHulugC) : java.lang.Throwable: 
E/AppLovinSdk( 2642):   at com.applovin.impl.sdk.o.aF(SourceFile:553)
E/AppLovinSdk( 2642):   at com.applovin.impl.sdk.o.a(SourceFile:421)
E/AppLovinSdk( 2642):   at com.applovin.sdk.AppLovinSdk.getInstance(SourceFile:434)
E/AppLovinSdk( 2642):   at com.google.ads.mediation.applovin.AppLovinSdkWrapper.getInstance(AppLovinSdkWrapper.java:38)
E/AppLovinSdk( 2642):   at com.google.ads.mediation.applovin.AppLovinInitializer.initialize(AppLovinInitializer.java:113)
E/AppLovinSdk( 2642):   at com.google.ads.mediation.applovin.AppLovinMediationAdapter.initialize(AppLovinMediationAdapter.java:202)
E/AppLovinSdk( 2642):   at com.google.android.gms.internal.ads.zzbow.zzq(com.google.android.gms:play-services-ads-lite@@22.3.0:14)
E/AppLovinSdk( 2642):   at com.google.android.gms.internal.ads.zzbny.zzbE(com.google.android.gms:play-services-ads-lite@@22.3.0:51)
E/AppLovinSdk( 2642):   at com.google.android.gms.internal.ads.zzatr.onTransact(com.google.android.gms:play-services-ads-base@@22.3.0:3)
E/AppLovinSdk( 2642):   at android.os.Binder.transact(Binder.java:675)
E/AppLovinSdk( 2642):   at m.aif.ba(:com.google.android.gms.policy_ads_fdr_dynamite@233012805@233012802057.555274289.555274289:8)
E/AppLovinSdk( 2642):   at com.google.android.gms.ads.internal.mediation.client.e.k(:com.google.android.gms.policy_ads_fdr_dynamite@233012805@233012802057.555274289.555274289:16)
E/AppLovinSdk( 2642):   at com.google.android.gms.ads.nonagon.initialization.g.run(:com.google.android.gms.policy_ads_fdr_dynamite@233012805@233012802057.555274289.555274289:29)
E/AppLovinSdk( 2642):   at android.os.Handler.handleCallback(Handler.java:907)
E/AppLovinSdk( 2642):   at android.os.Handler.dispatchMessage(Handler.java:105)
E/AppLovinSdk( 2642):   at m.avi.a(:com.google.android.gms.policy_ads_fdr_dynamite@233012805@233012802057.555274289.555274289:1)
E/AppLovinSdk( 2642):   at com.google.android.gms.ads.internal.util.f.a(:com.google.android.gms.policy_ads_fdr_dynamite@233012805@233012802057.555274289.555274289:2)
E/AppLovinSdk( 2642):   at m.avi.dispatchMessage(:com.google.android.gms.policy_ads_fdr_dynamite@233012805@233012802057.555274289.555274289:1)
E/AppLovinSdk( 2642):   at android.os.Looper.loop(Looper.java:216)
E/AppLovinSdk( 2642):   at android.app.ActivityThread.main(ActivityThread.java:7625)
E/AppLovinSdk( 2642):   at java.lang.reflect.Method.invoke(Native Method)
E/AppLovinSdk( 2642):   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
E/AppLovinSdk( 2642):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
E/AppLovinSdk( 2642): 
D/AppLovinSdk( 2642): [AppLovinSdk] Setting plugin version: 11.11.3.0
D/AppLovinInitializer( 2642): Attempting to initialize SDK with SDK Key: uCPGm3FkRLQQ95LDCZVAbs3I_C41xHHqTg4ElJyBfNcpSy1fWWq6NuON5TP1lgrDMwR5ENHulugCqisKEgRcZr
E/AppLovinSdk( 2642): [AppLovinSdk] Multiple SDK instances detected
D/AppLovinSdk( 2642): [AppLovinSdk] 
D/AppLovinSdk( 2642): ========================================
D/AppLovinSdk( 2642): SDK Session Begin
D/AppLovinSdk( 2642): ========================================
E/AppLovinSdk( 2642): [PersistentPostbackQueueSaveTaskV2] Skipping deserialization because maximum attempt count exceeded for postback: PostbackRequest{uniqueId='5956269a-6f48-408b-9d84-62dbd9e43727', communicatorRequestId='', httpMethod='', targetUrl='https://rt.applovin.com/4.0/pix', backupUrl='https://rt.applvn.com/4.0/pix', attemptNumber=3, isEncodingEnabled=true, isGzipBodyEncoding=false, isAllowedPreInitEvent=true, shouldFireInWebView=false}
E/AppLovinSdk( 2642): [PersistentPostbackQueueSaveTaskV2] Skipping deserialization because maximum attempt count exceeded for postback: PostbackRequest{uniqueId='8e7d8261-c35c-47a1-9d1a-24fc539802ee', communicatorRequestId='', httpMethod='', targetUrl='https://rt.applovin.com/4.0/pix', backupUrl='https://rt.applvn.com/4.0/pix', attemptNumber=3, isEncodingEnabled=true, isGzipBodyEncoding=false, isAllowedPreInitEvent=true, shouldFireInWebView=false}
D/AppLovinSdk( 2642): [AppLovinSdk] Setting plugin version: 11.11.3.0

And then later in app I can see two (inicializations?) of AppLovinSdk, one with proper key and second with 10 chars short

D/AppLovinSdk( 2642): [AppLovinSdk] 
D/AppLovinSdk( 2642): ========================================
D/AppLovinSdk( 2642): =====AppLovin SDK=====
D/AppLovinSdk( 2642): ===SDK Versions===
D/AppLovinSdk( 2642): Version: 11.11.3
D/AppLovinSdk( 2642): Plugin Version: 11.11.3.0
D/AppLovinSdk( 2642): Ad Review Version: 
D/AppLovinSdk( 2642): OM SDK Version: 1.4.1-Applovin
D/AppLovinSdk( 2642): ===Device Info===
D/AppLovinSdk( 2642): OS: 9 (P - API 28)
D/AppLovinSdk( 2642): GAID: <Enable verbose logging to see the GAID to use for test devices - https://monetization-support.applovin.com/hc/en-us/articles/236114328-How-can-I-expose-verbose-logging-for-the-SDK>
D/AppLovinSdk( 2642): Model: ANE-LX1
D/AppLovinSdk( 2642): Locale: en_GB
D/AppLovinSdk( 2642): Emulator: false
D/AppLovinSdk( 2642): Tablet: false
D/AppLovinSdk( 2642): ===App Info===
D/AppLovinSdk( 2642): Application ID: com.learn.how.to.draw.anime.step.by.step.drawing.lessons
D/AppLovinSdk( 2642): Target SDK: 34
D/AppLovinSdk( 2642): ExoPlayer Version: 2015001
D/AppLovinSdk( 2642): ===SDK Settings===
D/AppLovinSdk( 2642): SDK Key: uCPGm3FkRLQQ95LDCZVAbs3I_C41xHHqTg4ElJyBfNcpSy1fWWq6NuON5TP1lgrDMwR5ENHulugCqisKEgRcZr
D/AppLovinSdk( 2642): Mediation Provider: admob
D/AppLovinSdk( 2642): TG: 98
D/AppLovinSdk( 2642): AEI: 46
D/AppLovinSdk( 2642): MEI: 5
D/AppLovinSdk( 2642): Test Mode On: false
D/AppLovinSdk( 2642): Verbose Logging On: false
D/AppLovinSdk( 2642): ===Privacy States===
D/AppLovinSdk( 2642): Please review AppLovin MAX documentation to be compliant with regional privacy policies.
D/AppLovinSdk( 2642): 
D/AppLovinSdk( 2642): Age Restricted User - No value set
D/AppLovinSdk( 2642): Has User Consent - No value set
D/AppLovinSdk( 2642): "Do Not Sell" - No value set
D/AppLovinSdk( 2642): ===MAX Terms Flow===
D/AppLovinSdk( 2642): Enabled: false
D/AppLovinSdk( 2642): Privacy Policy URI: null
D/AppLovinSdk( 2642): Terms of Service URI: null
D/AppLovinSdk( 2642): ========================================
D/AppLovinSdk( 2642): [AppLovinSdk] 
D/AppLovinSdk( 2642): ========================================
D/AppLovinSdk( 2642): =====AppLovin SDK=====
D/AppLovinSdk( 2642): ===SDK Versions===
D/AppLovinSdk( 2642): Version: 11.11.3
D/AppLovinSdk( 2642): Plugin Version: 11.11.3.0
D/AppLovinSdk( 2642): Ad Review Version: 
D/AppLovinSdk( 2642): OM SDK Version: 1.4.1-Applovin
D/AppLovinSdk( 2642): ===Device Info===
D/AppLovinSdk( 2642): OS: 9 (P - API 28)
D/AppLovinSdk( 2642): GAID: <Enable verbose logging to see the GAID to use for test devices - https://monetization-support.applovin.com/hc/en-us/articles/236114328-How-can-I-expose-verbose-logging-for-the-SDK>
D/AppLovinSdk( 2642): Model: ANE-LX1
D/AppLovinSdk( 2642): Locale: en_GB
D/AppLovinSdk( 2642): Emulator: false
D/AppLovinSdk( 2642): Tablet: false
D/AppLovinSdk( 2642): ===App Info===
D/AppLovinSdk( 2642): Application ID: com.learn.how.to.draw.anime.step.by.step.drawing.lessons
D/AppLovinSdk( 2642): Target SDK: 34
D/AppLovinSdk( 2642): ExoPlayer Version: 2015001
D/AppLovinSdk( 2642): ===SDK Settings===
D/AppLovinSdk( 2642): SDK Key: uCPGm3FkRLQQ95LDCZVAbs3I_C41xHHqTg4ElJyBfNcpSy1fWWq6NuON5TP1lgrDMwR5ENHulugC
D/AppLovinSdk( 2642): Mediation Provider: admob
D/AppLovinSdk( 2642): TG: 54
D/AppLovinSdk( 2642): AEI: -1
D/AppLovinSdk( 2642): MEI: -1
D/AppLovinSdk( 2642): Test Mode On: false
D/AppLovinSdk( 2642): Verbose Logging On: false
D/AppLovinSdk( 2642): ===Privacy States===
D/AppLovinSdk( 2642): Please review AppLovin MAX documentation to be compliant with regional privacy policies.
D/AppLovinSdk( 2642): 
D/AppLovinSdk( 2642): Age Restricted User - No value set
D/AppLovinSdk( 2642): Has User Consent - No value set
D/AppLovinSdk( 2642): "Do Not Sell" - No value set
D/AppLovinSdk( 2642): ===MAX Terms Flow===
D/AppLovinSdk( 2642): Enabled: false
D/AppLovinSdk( 2642): Privacy Policy URI: null
D/AppLovinSdk( 2642): Terms of Service URI: null

Results are that none of AppLoving ads are loaded when testing on single source bidding. (Admob ones works fine).

Flutter code in main:

  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await FirebaseAnalytics.instance.logEvent(name: 'Step01_Initialize_Firebase');
  setupFirebaseCrashlytics();

  await MobileAds.instance.initialize().then((initializationStatus) {
    initializationStatus.adapterStatuses.forEach((key, value) {
      log('Ad mediation adapter status for $key: ${value.description}');
      log('Ad mediation adapter state for $key: ${value.state}');
      log('Ad mediation adapter latency state for $key: ${value.latency}');
    });
  });

  runApp(const MyApp());

I have tried, disabling initializations, working only with one type of ad (banner). But still I always get multiple SDK instances detected warning and double inicialization with one sdk key cut by 10 chars. I will be super gratful for any help or tips!

huycozy commented 1 year ago

Hi @StanislawNagorski It looks like you have set an incorrect AppLovin SDK key. Please take a look at https://github.com/AppLovin/AppLovin-MAX-SDK-Android/discussions/464.

Furthermore, this issue should be filed at AppLovin-MAX-SDK-Android repository for better support there. Closing this as it's not Flutter ad plugin issue.

StanislawNagorski commented 1 year ago

Hi @huycozy! Thanks for respond. However, we did double-check SDK, and in logs you can see that plugin makes double initialization of sdk one with full and correct SDK key and then second one where key is cut by 10 chars. You can see it at second code sample. Fist SKD is lunched with key: uCPGm3FkRLQQ95LDCZVAbs3I_C41xHHqTg4ElJyBfNcpSy1fWWq6NuON5TP1lgrDMwR5ENHulugCqisKEgRcZr and just after it with same key but cut with 10 chars uCPGm3FkRLQQ95LDCZVAbs3I_C41xHHqTg4ElJyBfNcpSy1fWWq6NuON5TP1lgrDMwR5ENHulugC Isn't it done by flutter plugin?

huycozy commented 1 year ago

If you notice the tag of those logs D/AppLovinSdk( 2642) which is logged from AppLovin SDK. That made me think it was caused by AppLovinSDK.

To be sure, could you please try this on an Android native project? Please select one of the native project here and add AppLovin SDK to check if the issue also appears there.