Here we will discuss an issue faced during the platform build of Ionic 3 application, having an AdMob Free plugin. You can see that error below, this issue comes when we don’t add AdMob app id in an application using AdMob Free Ionic 3 native Plugin.
Installing “cordova-plugin-admob-free” for android
Failed to install ‘cordova-plugin-admob-free’: Error: Variable(s) missing: ADMOB_APP_ID
at Object.mergeVariables (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\variable-merge.js:58:15)
at C:\Users\LENOVO\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:315:44
at _fulfilled (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:13)
at C:\Users\LENOVO\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:624:44
at runSingle (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Variable(s) missing: ADMOB_APP_ID
[ERROR] An error occurred while running subprocess cordova.cordova platform add android –save exited with exit code 1.
Re-running this command with the –verbose flag may provide more information.
Resolve this error by installing the AdMob Free plugin
We need to provide AdMob App ID using plugin installation
$ ionic cordova plugin add cordova-plugin-admob-free --save --variable ADMOB_APP_ID="ca-app-pub-2387490687776151~80XXXXXXX9"
Or you can manually add following code in config.xml
<plugin name="cordova-plugin-admob-free" spec="0.22.0">
<variable name="ADMOB_APP_ID" value="ca-app-pub-2387490687776151~80XXXXXXX9" />
</plugin>
Now you can build your application again without any issue 🙂
Leave a Reply