capacitor-community / capacitor-community/admob
Unable to obtain a JavascriptEngine
- Dominant language
- Java
- Stars
- 296
- Forks
- 97
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 7
Description
**Describe the bug**
Running application on device with real AdUnits and on simulator with Test Ad Units. I counter an error saying
Sending plugin error: {"save":false,"callbackId":"33634438","pluginId":"AdMob","methodName":"prepareInterstitial","success":false,"error":{"message":"Unable to obtain a JavascriptEngine."}}
Ad failed to load : 0
File: https://localhost/main.46b33a8cc361aa8b.js - Line 1 - Msg: ERROR Error: Unable to obtain a JavascriptEngine.
**To Reproduce**
Run the demo in android studio using ionic cap open android and chose latest android 14.0 in simulators. User will see no Ads loaded.
**Expected behavior**
Ad should be loaded
**Desktop (please complete the following information):**
None
**Smartphone (please complete the following information):**
- Device: Pixel 7 Pro API 34
- OS: Android 14
- Browser chrome
- Version "@capacitor-community/admob": "^5.3.1"
**Additional context**
It is related to WebView in latest Android versions.
Contributor guide
Research direction
Reproduce the failure from the demo/angular project by opening the Android project with ionic cap open android and using a Pixel 7 Pro API 34 simulator. Start by investigating the Android WebView context associated with the AdMob prepareInterstitial call and the reported JavascriptEngine error. Done means test ads load on Android 14 in the demo.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, angular
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100