[13:04:47] console.warn: Native: tried calling AdMobFree.config, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
[13:04:47] console.warn: Native: tried calling AdMobFree.prepare, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
1. error / warn
> ionic cordova run android --emulator -lc
BUILD SUCCESS 이후 EMULATOR 에서 동작하면 console.log 상에 warn 이 뜨며 AdMob 작동안함.
[13:04:47] console.warn: Native: tried calling AdMobFree.config, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
[13:04:47] console.warn: Native: tried calling AdMobFree.prepare, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
2. 원인
cordova 8.0.0 issue 가 워낙에 많아 해결 차원으로
{프로젝트폴더}\node_modules\@ionic\app-scripts\dist\dev-server\serve-config.js
exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'assets', 'www');
=> exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'app', 'src', 'main', 'assets', 'www');
수정했으나 플러그인들이 메이저 버전을 지원하지 않아 다시 downgrade 를 했었는데
에러발생! 애드몹이 작동하지 않는다!
[13:04:47] console.warn: Native: tried calling AdMobFree.config, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
[13:04:47] console.warn: Native: tried calling AdMobFree.prepare, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
android 버전을 6.4.0 으로 다운그레이드 했다.
> ionic info
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 6.4.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v8.9.1
npm : 5.6.0
OS : Windows 10
위에서 수정한 걸 원상복구한다.
exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'app', 'src', 'main', 'assets', 'www');
=> exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'assets', 'www');