我正在尝试将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'
答案 0 :(得分:2)
测试后更新并找到合适的解决方案..
好的,我现在只使用Firebase进行云消息传递,所以我的解决方案可能比你的解决方案简单得多。基本上我开始添加firebase-core,它抱怨在不同版本中多次请求播放服务测量基础。所以我从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文档中所述[{3}}
哦,我还应该提一下,在我的项目级gradle构建文件中,我的buildscript依赖项需要更新。
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
}
}
希望这有帮助! 祝你好运
答案 1 :(得分:1)
我终于弄明白了,我真的很愚蠢,花了这么长时间才弄清楚。我要做的就是更改play-services-base
和play-services-map versions to 15.0.1.
,还必须在更改后清理build
。
感谢您对basudz进行调查,您的解决方案让我感到困惑。我对Android
的了解不如应有。我正在尝试使其更熟悉,这是一个bit子。