「Javascript/reactnative/admob/react-native-cli/react-native-firebase」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→react-native-firebaseインストール) |
(→react-native-firebaseインストール) |
||
行3: | 行3: | ||
yarn add @react-native-firebase/admob | yarn add @react-native-firebase/admob | ||
+ | ===インストール確認=== | ||
package.jsonにreact-native-firebaseとadmobが入ってるか確認。 | package.jsonにreact-native-firebaseとadmobが入ってるか確認。 | ||
"dependencies": { | "dependencies": { | ||
行10: | 行11: | ||
"react-native": "0.63.2" | "react-native": "0.63.2" | ||
}, | }, | ||
+ | |||
+ | ===Androidでの追加設定=== | ||
+ | #google-services.jsonをandroid/appの下に置く | ||
+ | |||
+ | andorid/build.gradle | ||
+ | <pre> | ||
+ | buildscript { | ||
+ | ext { | ||
+ | buildToolsVersion = "29.0.2" | ||
+ | minSdkVersion = 16 | ||
+ | compileSdkVersion = 29 | ||
+ | targetSdkVersion = 29 | ||
+ | } | ||
+ | repositories { | ||
+ | google() | ||
+ | jcenter() | ||
+ | } | ||
+ | dependencies { | ||
+ | classpath("com.android.tools.build:gradle:3.5.3") | ||
+ | classpath 'com.google.gms:google-services:4.2.0' # add | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | android/app/build.gradle | ||
+ | apply plugin: 'com.google.gms.google-services' | ||
===参考=== | ===参考=== |
2020年10月1日 (木) 17:53時点における版
react-native-firebaseインストール
yarn add @react-native-firebase/app yarn add @react-native-firebase/admob
インストール確認
package.jsonにreact-native-firebaseとadmobが入ってるか確認。
"dependencies": { "@react-native-firebase/admob": "^7.5.1", "@react-native-firebase/app": "^8.4.5", "react": "16.13.1", "react-native": "0.63.2" },
Androidでの追加設定
- google-services.jsonをandroid/appの下に置く
andorid/build.gradle
buildscript { ext { buildToolsVersion = "29.0.2" minSdkVersion = 16 compileSdkVersion = 29 targetSdkVersion = 29 } repositories { google() jcenter() } dependencies { classpath("com.android.tools.build:gradle:3.5.3") classpath 'com.google.gms:google-services:4.2.0' # add } }
android/app/build.gradle
apply plugin: 'com.google.gms.google-services'
参考
https://dev-yakuza.github.io/react-native/react-native-firebase-admob/