Reputation: 43
I need to setup admob in my application I use react native v0.57.3 I have installed lets see:
app/build.gralde:
dependencies {
compile project(':react-native-firebase')
compile project(':react-native-admob')
implementation project(':react-native-imei')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-vector-icons')
implementation project(':react-native-fast-image')
implementation project(':react-native-device-info')
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-core:16.0.6"
implementation "com.google.firebase:firebase-messaging:17.3.4"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
implementation ("com.google.android.gms:play-services-vision:16.2.0") {
force = true
}
implementation project(':react-native-view-shot')
}
settings.gradle:
include ':react-native-admob'
project(':react-native-admob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-admob/android')
mainApplication.java:
import com.sbugert.rnadmob.RNAdMobPackage;
and
new RNAdMobPackage()
menifest:
in application tag:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="APP ID"/>
When I try to build gradle I get this error: Compilation failed to complete
Anyone can help me please??
Error When I comment this line // implementation "com.google.firebase:firebase-core:16.0.6" I get this error "Compilation failed to complete"
But If I leave it I get this error: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[16.0. 5]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.firebase:firebase-measurement-connector-impl:17.0.4 -> com.google.android.gms:play-servic es-measurement-base@[16.0.5], but play-services-measurement-base version was 16.3.0.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art ifact with the issue. -- Project 'app' depends on project 'react' which depends onto com.google.android.gms:play-services-ads@+ -- Project 'app' depends onto com.google.firebase:[email protected]
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https:// github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b uild.gradle file.
Upvotes: 2
Views: 1400
Reputation: 228
It’s because your react-native-addmob and react-native-firebase might be using different version of google play services and base version. Match the version better probably it will fit around 15.x.x
. Check that.
Moreover why do you need a react-native-admob? As per as I know react-native-firebase provide admob. I would suggest you to use firebase service for that since you already have that library integrated. https://rnfirebase.io/docs/v4.0.x/admob/reference/admob
Upvotes: 1