Reputation: 67
I am using AppLovin MAX
for mediation in my android application but when i tried to add banner ad like below
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();
}
i got the following error at run time
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)
I tried most of solutions including adding Google Play Services SDK but the problem still occurs from both my Android Emulator and Real Device. Below are list of dependencies am using
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'}
I added ProGuard Exception
as instructed in stackTrace above
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 *; }
Till now i dont know what to do.. is it issue related to AppLovin? What can i do to solve it?
Upvotes: 2
Views: 2568
Reputation: 67
I solved this problem... I was just trying to use Tab Layout in my app with two fragments within each , I decided to add Banner programmatically that why i got this error...but when shifted to XML banner it worked fine..
I tried to add Interstitial Ads the problem appeared again..then what i learnt was that AppLovin Ads added programatically doesnot support fragments but they working fine in activities
Upvotes: 1