facebook twitter hatena line email

「Monaca/admob/admob-free/gitlab」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(browserSyncエラー)
(Admob設定)
行37: 行37:
 
cordova-plugin-admob-freeプラグインから設定を選択し以下のように入力欄に入れる。
 
cordova-plugin-admob-freeプラグインから設定を選択し以下のように入力欄に入れる。
 
  ADMOB_APP_ID=ca-app-pub-0679xxxxxxxxxxxxx/896xxxxxxxxxx
 
  ADMOB_APP_ID=ca-app-pub-0679xxxxxxxxxxxxx/896xxxxxxxxxx
 +
 +
==admobがない==
 +
Uncaught ReferenceError: admob is not defined
  
 
==browserSyncエラー==
 
==browserSyncエラー==

2020年5月21日 (木) 20:44時点における版

ダウンロード&インストール

gitlab https://gitlab.com/ratson/cordova-admob-sdk

  • zipでDLしてmonacaへインポート
  1. インポートするとアップデートするボタンが出るので押す。

プラグイン追加

  1. 設定/cordovaプラグイン/cordovaプラグインのインポートボタンをクリック
  2. 入力欄に"cordova-plugin-admob-free"を入力しインポート


xmlからプラグイン追加

config.xmlの</widget>の1つ上に以下を追加

<plugin name="cordova-plugin-admob-free" spec="~0.12.0" />
  1. プレビューLogを更新する
  2. フォルダリストの表示を更新する
  3. 以下ファイルができてることを確認。
node_modules/cordova-plugin-admob-free/www/admob.js


確認

package.jsonに以下が記載されてることを確認

    "cordova": {
        "id": "cordova-plugin-admob-free",
        "platforms": [
            "android",
            "ios"
        ]
    },

Admob設定

cordova-plugin-admob-freeプラグインから設定を選択し以下のように入力欄に入れる。

ADMOB_APP_ID=ca-app-pub-0679xxxxxxxxxxxxx/896xxxxxxxxxx

admobがない

Uncaught ReferenceError: admob is not defined

browserSyncエラー

以下エラーは、表示のブラウザ同期に失敗しただけで、環境が悪いだけで、コードの挙動には、あまり関係ないと思われる・・。

couldn't open browser (if you are using browserSync in a headless environment, you might want to set the open option to false

Security Policyエラーが発生

Refused to load the script 'https://debug.monaca.mobi/target/target-script-min.js' because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'default-src' is used as a fallback.

npm install実行時の脆弱性の警告

`npm audit fix` to fix them or `npm audit` for details

以下で確認

npm audit fix

npm run buildでエラー

以下エラー

verbose stack Error: missing script build 
lib/node_modules/npm/lib/-script.js:155:19

以下コマンドで対応すると良いらしいが・・

webpack -v
npm install webpack -g

参考:https://blog.csdn.net/qq_37591637/article/details/103576163

以下のようなエラーが新たに起こった。権限の問題かも・・

path /opt/node-v10.15.3/lib/node/modules
code EACCES
errno 13

参考:https://qiita.com/okohs/items/ced3c3de30af1035242d

json404のエラーが発生

{"status": "fail", "code": 404," message": "Not found"}

参考

https://senmyou.xyz/cordova-admob-free%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%E3%81%A7%E5%BA%83%E5%91%8A%E3%82%92%E8%A1%A8%E7%A4%BA/