I try to embed advertising in the application, following the office. A guide that states that the described method does not require Firebase.
public class AndroidLauncher extends AndroidApplication { protected AdView adView; protected View gameView; private InterstitialAd interstitialAd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); //View gameView = initializeForView(new AdMobTest(), config); gameView = initializeForView(new AdMobTest(), config); RelativeLayout layout = new RelativeLayout(this); // Do the stuff that initialize() would do for you requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); // Create and setup the AdMob view AdRequest.Builder builder = new AdRequest.Builder(); builder.addTestDevice("6BD6DB797D7C2C576A7317E3BBF21B75"); InterstitialAd mInterstitialAd = new InterstitialAd(this); mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712"); mInterstitialAd.loadAd(builder.build()); mInterstitialAd.show(); // Hook it all up setContentView(layout); } } At the same time I get these messages in the logs:
07-23 00:15:43.302 24810-25044/com.admobtest.test W/Ads: Invoke Firebase method getInstance error. 07-23 00:15:43.302 24810-25044/com.admobtest.test W/Ads: The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar, but Firebase SDK is either missing or out of date 07-23 00:15:43.418 24810-24810/com.admobtest.test I/Ads: Updating ad debug logging enablement. 07-23 00:15:43.464 24810-24810/com.admobtest.test I/Ads: Starting ad request. 07-23 00:15:43.464 24810-24810/com.admobtest.test I/Ads: This request is sent from a test device. 07-23 00:15:43.473 24810-24810/com.admobtest.test W/Ads: Not retrying to fetch app settings 07-23 00:15:43.488 24810-24810/com.admobtest.test W/Ads: The interstitial has not loaded. 07-23 00:15:43.567 24810-25018/com.admobtest.test W/Ads: Update ad debug logging enablement as false 07-23 00:15:44.041 24810-24939/com.admobtest.test W/Ads: There was a problem getting an ad response. ErrorCode: 0 07-23 00:15:44.045 24810-24810/com.admobtest.test W/Ads: Failed to load ad: 0 I use libgdx. I'm testing on a physical device.
PS The solution was to add to build.gradle:
android { // ... } dependencies { // ... implementation 'com.google.firebase:firebase-core:16.0.1' // Getting a "Could not find" error? Make sure you have // added the Google maven respository to your root build.gradle } // ADD THIS AT THE BOTTOM apply plugin: 'com.google.gms.google-services'