所有 firebase 库必须高于或低于 14.0.0(react-native-maps 和 react-native-firebase)
All firebase libraries must be either above or below 14.0.0 (react-native-maps & react-native-firebase)
我正在尝试将 react-native-maps 添加到我的 react-native-firebase 入门应用程序中。在我尝试添加 react-native-maps 之前我没有收到错误。下面是我完全按照他们的说明操作后的代码。我尝试将地图依赖项更改为 15.0.1 并删除重复的播放服务,但这并没有解决任何问题。非常感谢任何帮助或见解!一个多星期以来,我一直在研究这个问题并寻找答案。
dependencies {
implementation project(':react-native-vector-icons')
// react-native-google-signin
implementation(project(':react-native-google-signin')) {
exclude group: "com.google.android.gms"
}
implementation 'com.google.android.gms:play-services-auth:15.0.0'
// react-native-fbsdk
implementation project(':react-native-fbsdk')
implementation(project(':react-native-firebase')) {
transitive = false
}
// RNFirebase required dependencies
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.android.gms:play-services-base:15.0.0"
// RNFirebase optional dependencies
implementation "com.google.firebase:firebase-auth:15.1.0"
implementation "com.google.firebase:firebase-database:15.0.0"
implementation "com.google.firebase:firebase-firestore:16.0.0"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:27.0.2"
implementation "com.facebook.react:react-native:+" // From node_modules
// react-native-maps required dependencies
implementation(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:10.0.1'
implementation 'com.google.android.gms:play-services-maps:10.0.1'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
测试后更新并找到合适的解决方案..
好的,我现在只使用 Firebase 进行云消息传递,所以我的解决方案可能比您的要简单得多。基本上我从添加 firebase-core 开始,它抱怨 play-services-measurement-base 在不同版本中被多次请求。所以我从 firebase-core 依赖项中排除了 AND 添加它独立强制它被请求的版本。
然后它抱怨 firebase-analytics,我遵循与上面相同的模式,但是,然后它再次给了我第一个错误 play-services-measurement-base。我不得不从 firebase-analytics 中排除它才能继续。
接下来我添加了 firebase-messaging,它给了我 firebase-iid 依赖项相同的错误,我遵循了之前的模式。
您有更多的 firebase 依赖项,因此您可能必须像这样一一检查。
这是我的依赖块。
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+"
implementation project(':react-native-device-info')
implementation project(':react-native-config')
implementation project(':react-native-image-picker')
implementation project(':react-native-sentry')
implementation project(':react-native-vector-icons')
implementation project(':react-native-maps')
implementation project(':react-native-firebase')
implementation "com.google.android.gms:play-services-base:${rootProject.ext.googlePlayServicesVersion}"
implementation ("com.google.android.gms:play-services-measurement-base:15.0.4") {
force = true
}
implementation ("com.google.firebase:firebase-analytics:16.0.0") {
force = true
exclude module: 'play-services-measurement-base'
exclude module: 'firebase-analytics-impl'
}
implementation ("com.google.firebase:firebase-analytics-impl:16.0.0") {
force = true
exclude module: 'play-services-measurement-base'
}
implementation ("com.google.firebase:firebase-iid:16.0.0") {
force = true
}
implementation ('com.google.firebase:firebase-core:16.0.0'){
exclude module: 'play-services-measurement-base'
exclude module: "firebase-analytics"
exclude module: "firebase-analytics-impl"
}
implementation ('com.google.firebase:firebase-messaging:17.0.0'){
exclude module: 'firebase-iid'
}
}
我还为 react-native-maps 设置了项目范围的属性,以便在他们的 Android 文档中提到 https://github.com/react-community/react-native-maps/blob/master/docs/installation.md#android
哦,我还应该提到,在我的项目级别 gradle 构建文件中,我的构建脚本依赖项需要更新。
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
}
}
希望对您有所帮助!
祝你好运
终于想通了,自己弄了这么久才觉得真的很蠢。我所要做的就是更改 play-services-base
和 play-services-map versions to 15.0.1.
我还必须在更改后清理 build
。
感谢您调查 basudz,您的解决方案让我难以理解。我对 Android
并不像我应该的那样熟悉。我正在尝试更熟悉它,它是个婊子。
我正在尝试将 react-native-maps 添加到我的 react-native-firebase 入门应用程序中。在我尝试添加 react-native-maps 之前我没有收到错误。下面是我完全按照他们的说明操作后的代码。我尝试将地图依赖项更改为 15.0.1 并删除重复的播放服务,但这并没有解决任何问题。非常感谢任何帮助或见解!一个多星期以来,我一直在研究这个问题并寻找答案。
dependencies {
implementation project(':react-native-vector-icons')
// react-native-google-signin
implementation(project(':react-native-google-signin')) {
exclude group: "com.google.android.gms"
}
implementation 'com.google.android.gms:play-services-auth:15.0.0'
// react-native-fbsdk
implementation project(':react-native-fbsdk')
implementation(project(':react-native-firebase')) {
transitive = false
}
// RNFirebase required dependencies
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.android.gms:play-services-base:15.0.0"
// RNFirebase optional dependencies
implementation "com.google.firebase:firebase-auth:15.1.0"
implementation "com.google.firebase:firebase-database:15.0.0"
implementation "com.google.firebase:firebase-firestore:16.0.0"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:27.0.2"
implementation "com.facebook.react:react-native:+" // From node_modules
// react-native-maps required dependencies
implementation(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:10.0.1'
implementation 'com.google.android.gms:play-services-maps:10.0.1'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
测试后更新并找到合适的解决方案..
好的,我现在只使用 Firebase 进行云消息传递,所以我的解决方案可能比您的要简单得多。基本上我从添加 firebase-core 开始,它抱怨 play-services-measurement-base 在不同版本中被多次请求。所以我从 firebase-core 依赖项中排除了 AND 添加它独立强制它被请求的版本。 然后它抱怨 firebase-analytics,我遵循与上面相同的模式,但是,然后它再次给了我第一个错误 play-services-measurement-base。我不得不从 firebase-analytics 中排除它才能继续。
接下来我添加了 firebase-messaging,它给了我 firebase-iid 依赖项相同的错误,我遵循了之前的模式。
您有更多的 firebase 依赖项,因此您可能必须像这样一一检查。
这是我的依赖块。
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+"
implementation project(':react-native-device-info')
implementation project(':react-native-config')
implementation project(':react-native-image-picker')
implementation project(':react-native-sentry')
implementation project(':react-native-vector-icons')
implementation project(':react-native-maps')
implementation project(':react-native-firebase')
implementation "com.google.android.gms:play-services-base:${rootProject.ext.googlePlayServicesVersion}"
implementation ("com.google.android.gms:play-services-measurement-base:15.0.4") {
force = true
}
implementation ("com.google.firebase:firebase-analytics:16.0.0") {
force = true
exclude module: 'play-services-measurement-base'
exclude module: 'firebase-analytics-impl'
}
implementation ("com.google.firebase:firebase-analytics-impl:16.0.0") {
force = true
exclude module: 'play-services-measurement-base'
}
implementation ("com.google.firebase:firebase-iid:16.0.0") {
force = true
}
implementation ('com.google.firebase:firebase-core:16.0.0'){
exclude module: 'play-services-measurement-base'
exclude module: "firebase-analytics"
exclude module: "firebase-analytics-impl"
}
implementation ('com.google.firebase:firebase-messaging:17.0.0'){
exclude module: 'firebase-iid'
}
}
我还为 react-native-maps 设置了项目范围的属性,以便在他们的 Android 文档中提到 https://github.com/react-community/react-native-maps/blob/master/docs/installation.md#android
哦,我还应该提到,在我的项目级别 gradle 构建文件中,我的构建脚本依赖项需要更新。
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
}
}
希望对您有所帮助! 祝你好运
终于想通了,自己弄了这么久才觉得真的很蠢。我所要做的就是更改 play-services-base
和 play-services-map versions to 15.0.1.
我还必须在更改后清理 build
。
感谢您调查 basudz,您的解决方案让我难以理解。我对 Android
并不像我应该的那样熟悉。我正在尝试更熟悉它,它是个婊子。