title: How to fix the Android AdMob "Unable to obtain a JavascriptEngine" error?
body: <p><code>MainActivity</code></p>
  <pre><code>class MainActivity : AppCompatActivity() {
  
      override fun onCreate(savedInstanceState: Bundle?) {
  
          MobileAds.initialize(this) {}
          MobileAds.setRequestConfiguration(
              RequestConfiguration.Builder()
                  .setTestDeviceIds(listOf(&quot;ABCDEF012345&quot;))
                  .build()
          )
  
          val adRequest = AdRequest.Builder().build()
          Log.d(&quot;Activity&quot;, &quot;Is Test Device? : ${adRequest.isTestDevice(this)}&quot;)
          adView.loadAd(adRequest)
  
          adView.adListener = object : AdListener() {
              override fun onAdLoaded() {
                  super.onAdLoaded()
                  Log.d(&quot;Activity&quot;, &quot;@@ onAdLoaded()&quot;)
              }
  
              override fun onAdFailedToLoad(err: LoadAdError?) {
                  super.onAdFailedToLoad(err)
                  Log.d(&quot;Activity&quot;, &quot;@@ onAdFailedToLoad()\n$err&quot;)
              }
  
              override fun onAdOpened() {
                  super.onAdOpened()
                  Log.d(&quot;Activity&quot;, &quot;@@ onAdOpened()&quot;)
              }
  
              override fun onAdClicked() {
                  super.onAdClicked()
                  Log.d(&quot;Activity&quot;, &quot;@@ onAdClicked()&quot;)
              }
  
              override fun onAdLeftApplication() {
                  super.onAdLeftApplication()
                  Log.d(&quot;Activity&quot;, &quot;@@ onAdLeftApplication()&quot;)
              }
  
              override fun onAdClosed() {
                  super.onAdClosed()
                  Log.d(&quot;Activity&quot;, &quot;@@ onAdClosed()&quot;)
              }
          }
      }
  }
  </code></pre>
  <p><code>activity_main.xml</code></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout                       
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:ads=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.MainActivity&quot;&gt;
  
      &lt;com.google.android.gms.ads.AdView
          android:id=&quot;@+id/adView&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_gravity=&quot;center_horizontal&quot;
          android:layout_marginTop=&quot;8dp&quot;
          android:layout_marginBottom=&quot;8dp&quot;
          ads:adSize=&quot;BANNER&quot;
          ads:adUnitId=&quot;@string/banner_ad_unit_id_for_test&quot; /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  <p><code>string.xml</code></p>
  <pre><code>&lt;resources&gt;
      &lt;string name=&quot;admob_app_id&quot;&gt;ca-app-pub-000000000000~00000000000&lt;/string&gt;
      &lt;string name=&quot;bannera_ad_unit_id_for_test&quot;&gt;ca-app-pub-3940256099942544/6300978111&lt;/string&gt;
  &lt;/resources&gt;
      
  </code></pre>
  <p>I created <code>&lt;meta-dat&gt;</code> in the manifest and added <code>admob_app_id</code> as the <code>android:value</code> value inside. In the AVD test device provided by Android Studio, a test advertisement appeared without any problems, but the test advertisement did not appear on the actual device. So, as in the <code>MainActivity</code> code above, I called <code>RequestConfiguration</code> and added my mobile device ID(<code>&quot;ABCDEF012345&quot;</code>) to the test device ID, but the problem was not resolved. The contents of the error were as follows.</p>
  <p><a href="https://i.stack.imgur.com/PungZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PungZ.png" alt="enter image description here" /></a></p>