1

AppLovin MAX在我的 android 应用程序中使用中介,但是当我尝试添加如下横幅广告时

 void createBannerView(View view){
    final String bannerAdUni = getString(R.string.bannerAdUnits);
    adView = new MaxAdView(bannerAdUni,getActivity());
    ViewGroup viewGroup = view.findViewById(R.id.content);
    adView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM));
    viewGroup.addView(adView);

    adView.loadAd();
}

我在运行时收到以下错误

AppLovinSdk: [DataCollector] Could not collect Google Advertising ID - this will negatively impact your eCPMs! Please integrate the Google Play Services SDK into your application. More info can be found online at http://developer.android.com/google/play-services/setup.html. If you're sure you've integrated the SDK and are still seeing this message, you may need to add a ProGuard exception: -keep public class com.google.android.gms.** { public protected *; }
java.io.IOException: java.util.concurrent.TimeoutException: Timed out waiting for the service connection
    at com.google.android.gms.ads.identifier.AdvertisingIdClient.zza(Unknown Source:16)
    at com.google.android.gms.ads.identifier.AdvertisingIdClient.zza(Unknown Source:25)
    at com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(Unknown Source:47)
    at com.applovin.impl.sdk.m.c(Unknown Source:15)
    at com.applovin.impl.sdk.m.j(Unknown Source:2)
    at com.applovin.impl.sdk.m.a(Unknown Source:84)
    at com.applovin.impl.sdk.m.a(Unknown Source:11)
    at com.applovin.impl.sdk.m.a(Unknown Source:7)
    at com.applovin.impl.sdk.EventServiceImpl.a(Unknown Source:24)
    at com.applovin.impl.sdk.EventServiceImpl.a(Unknown Source:0)
    at com.applovin.impl.sdk.EventServiceImpl$1.run(Unknown Source:29)
    at com.applovin.impl.sdk.e.y.run(Unknown Source:2)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)
 Caused by: java.util.concurrent.TimeoutException: Timed out waiting for the service connection
    at com.google.android.gms.common.BlockingServiceConnection.getServiceWithTimeout(com.google.android.gms:play-services-basement@@17.5.0:13)
    at com.google.android.gms.ads.identifier.AdvertisingIdClient.zza(Unknown Source:4)
    at com.google.android.gms.ads.identifier.AdvertisingIdClient.zza(Unknown Source:25) 
    at com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(Unknown Source:47) 
    at com.applovin.impl.sdk.m.c(Unknown Source:15) 
    at com.applovin.impl.sdk.m.j(Unknown Source:2) 
    at com.applovin.impl.sdk.m.a(Unknown Source:84) 
    at com.applovin.impl.sdk.m.a(Unknown Source:11) 
    at com.applovin.impl.sdk.m.a(Unknown Source:7) 
    at com.applovin.impl.sdk.EventServiceImpl.a(Unknown Source:24) 
    at com.applovin.impl.sdk.EventServiceImpl.a(Unknown Source:0) 
    at com.applovin.impl.sdk.EventServiceImpl$1.run(Unknown Source:29) 
    at com.applovin.impl.sdk.e.y.run(Unknown Source:2) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
    at java.lang.Thread.run(Thread.java:764) 

我尝试了大多数解决方案,包括添加 Google Play Services SDK,但我的 Android Emulator 和 Real Device 仍然存在问题。以下是正在使用的依赖项列表

dependencies {

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'

/*---------- APPLOvIN  -------*/
implementation 'com.applovin:applovin-sdk:+'
implementation 'com.applovin.mediation:vungle-adapter:6.10.2.0'
implementation 'com.applovin.mediation:facebook-adapter:+'
implementation 'com.facebook.android:facebook-android-sdk:12.1.0'
implementation 'com.google.android.gms:play-services-ads-identifier:17.1.0'

implementation 'androidx.ads:ads-identifier:1.0.0-alpha04'

// Used for the calls to addCallback() in the snippets on this page.
implementation 'com.google.guava:guava:28.0-android'

implementation 'com.android.volley:volley:1.2.1'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
implementation 'com.google.android.gms:play-services-auth-base:17.1.4'

testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core :3.4.0'}

ProGuard Exception按照上面 stackTrace 中的说明添加了

如果您确定已集成 SDK 并且仍然看到此消息,则可能需要添加 ProGuard 异常:-keep public class com.google.android.gms.** { public protected *; }

直到现在我不知道该怎么办..是与AppLovin有关的问题吗?我能做些什么来解决它?

4

1 回答 1

1

我解决了这个问题......我只是试图在我的应用程序中使用标签布局,每个片段中有两个片段,我决定以编程方式添加横幅,这就是为什么我得到这个错误......但是当转移到 XML 横幅时它工作正常......

我尝试添加插页式广告,问题再次出现..然后我了解到 AppLovin Ads 以编程方式添加不支持片段,但它们在活动中运行良好

于 2021-11-23T11:06:53.437 回答