I am trying to add MoPub banner to my app and i've got error in logs: Unable to obtain Google AdvertisingIdClient.Info via reflection. Am i doing something wrong? P.S I am using test ad ID.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
moPubViewBanner=(MoPubView)findViewById(R.id.banner_ad);
moPubViewBanner.setAdUnitId("b195f8dd8ded45fe847ad89ed1d016da");
SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder("MOPUB_ID")
.withLogLevel(MoPubLog.LogLevel.DEBUG)
.withLegitimateInterestAllowed(false)
.build();
MoPub.initializeSdk(this, sdkConfiguration, new SdkInitializationListener() {
@Override
public void onInitializationFinished() {
Log.d("Mopub", "SDK initialized");
moPubViewBanner.loadAd();
}
});
}
You need to integrate Google Play services:
Get the latest version at https://developers.google.com/android/guides/releases.