title: What is the correct way to initialize AdMob when you also use LVL in your app?
body: <p>I tried to find a previous post about using AdMob with LVL but could not on this site (or anywhere else). I tried looking at every post about AdMob and LVL but there's too many.  Searching on "AdMob and LVL" should have turned up a question about my exact concern but there is no previous question on this topic.</p>
  
  <p>What is the correct way to initialize AdMob when you also use LVL in your app?  Is LVL and AdMob(specificially AdMob interstitial ads) basically incompatible with each other?</p>
  
  <p>My problem is I want to use LVL to check for a valid license in my Android app which also displays AdMob interstitial ads.  When I use just LVL for my free app LVL functions properly.  When I take out my use of LVL in the app and display AdMob interstitial ads that works just fine (I see ads properly displayed whenever the code is supposed to display an ad).  However...when I use/activate both LVL and AdMob interstitial ads my app fails.  Here are some details on the failure.  When I activate both LVL and AdMob interstitial then the automated Firebase testing on Google Play (the only place I allow my game to be downloaded) fails.  However when I use Android Studio to Run that version over a USB link to my test device it runs ok.  I was fooled by this result and published that version to production.  When I deleted the old version from all 
  my test devices and downloaded from Google Play the new version it crashes.  I can't tell you what the error message was when I Run under Android Studio because there was no error!  When I executed the downloaded version, well, it just says "unfortunately "app name" stopped" </p>
  
  <p>Basically.  I do not have Firebase linked to my app and I might guess that is why the firebase testing failed (or maybe not).  When I tested that AdMob interstitial ads were working I don't think I uploaded that to Google Play therefore I don't know what Firebase would do with AdMob:yes and LVL:no.</p>
  
  <p>However, here is what the error entries for the Firebase failures says for all of the crashes:</p>
  
  <pre><code>java.lang.RunTimeException: Unable to start activity
  
  ComponentInfo("my app specification")java.lang.IllegalArgumentException:
  
  Unexpected number of IObjectWrapper declared fields: 5
  </code></pre>
  
  <p>The way I call to LVL is to make the call at the end of my OnCreate for the main Activity.  </p>
  
  <p>My LVL call sequence looks like:</p>
  
  <pre><code>mHandler=new Handler();
  String deviceID=Settings.Secure.getString(whatever);
  mLicenseCheckCallback=new MyLicenseCheckerCallback();
  mChecker=new LicenseChecker(whatever);
  docheck();
  </code></pre>
  
  <p>docheck is a call basically:</p>
  
  <pre><code>mChecker.checkAccess(whatever);
  </code></pre>
  
  <p>There is nothing special about the LVL initialization sequence, it's the same one everyone uses as far as I know.</p>
  
  <p>I put the AdMob initialization code per the InterstitialExample immediately after the above LVL code </p>
  
  <p>at end of OnCreate.:i.e. </p>
  
  <p>MobileAds.initialize(whatever), etc.</p>
  
  <p>The initialization code is exactly the same as for the latest example of an AdMob Interstitial ad.  And it is functional when LVL is not initialized, I 
  see real-live ads when I run it.</p>
  
  <p>I tried putting the Admob initialization immediately before the LVL code but that doesn't work.  Where I really want to show an interstitial ad is off in an Activity I start by:</p>
  
  <pre><code>   Intent intent=new Intent(whatever);
      startActivity(intent);
  </code></pre>
  
  <p>I have not tried moving the initialization code over into that offshoot Activity (to be executed just once if it has never been executed).</p>
  
  <p>Anyone know what I should do to fix this?  Since the app is free, I suppose I could just remove LVL and since the ads work ok, then I would release the app in the wild.  But I don't want to have to deal with it being downloaded from sites other than Google Play.  I don't want someone else to sell access to it when it is free!</p>
  
  <p>Either there is a different initialization method for AdMob Interstitial ads (that is different from the basic example provided) when you also use LVL or AdMob and LVL are incompatible or there is "something else you must do too".</p>