应用程序继续停止反应原生地图并反应原生firebase

时间:2017-10-04 19:20:00

标签: android gradle react-native react-native-maps

我使用react-native-mapsreact-native-firebase以及play-services-base碰撞问题。在响应本机映射依赖项play-services-base:10.2.4play-services-maps:10.2.4中。 React native firebase使用11.4.2

当run-android我的应用程序保持停止没有错误。我删除react native maps模块时很好。

这是我的gradle

compile(project(':react-native-maps')) 
{
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
}    
compile ('com.google.android.gms:play-services-base:11.4.2') {    
    force = true;
}
compile ('com.google.android.gms:play-services-maps:11.4.2') {
    force = true;
}

compile(project(':react-native-firebase')) {
    transitive = false
}
compile "com.google.firebase:firebase-core:11.4.2"
compile "com.google.firebase:firebase-auth:11.4.2"
compile "com.google.firebase:firebase-database:11.4.2"
compile "com.google.firebase:firebase-firestore:11.4.2"
compile "com.google.firebase:firebase-storage:11.4.2"

我不熟悉gradle和java。

1 个答案:

答案 0 :(得分:1)

您是否还有其他与com.google.android.gms或com.google.firebase相关的库?你可以参考这个post

我修改了build.gradle,如下所示

dependencies {
 compile project(':react-native-config')
 compile project(':react-native-version-number')
 compile(project(':react-native-maps')){
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
 }
 compile (project(':react-native-fcm')){
    exclude group: 'com.google.firebase'
 }
 compile (project(':react-native-device-info')){
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-gcm'
 }
 compile(project(':react-native-firebase')) {
    exclude group: 'com.google.android.gms'
    exclude group: 'com.google.firebase'
    transitive = false
 }
 .......
 compile 'com.android.support:appcompat-v7:25.1.0'
 compile 'com.android.support:design:25.1.0'
 compile 'com.android.support:recyclerview-v7:25.1.0'

 compile "com.facebook.react:react-native:+"  // From node_modules
 compile ("com.google.android.gms:play-services-base:11.4.2") {
    force = true;
 }
 compile ("com.google.android.gms:play-services-gcm:11.4.2") {
    force = true;
 }
 compile ("com.google.android.gms:play-services-maps:11.4.2") {
    force = true;
 }
 compile ("com.google.android.gms:play-services-location:11.4.2") {
    force = true;
 }
 compile ("com.google.firebase:firebase-core:11.4.2") { //this decides your firebase SDK version
    force = true;
}
 // RNFirebase optional dependencies
 compile ("com.google.firebase:firebase-ads:11.4.2") {
    force = true;
 }
 compile ("com.google.firebase:firebase-auth:11.4.2") {
    force = true;
 }
 compile ("com.google.firebase:firebase-config:11.4.2") {
    force = true;
 }
 compile ("com.google.firebase:firebase-crash:11.4.2") {
    force = true;
 }
 compile ("com.google.firebase:firebase-database:11.4.2") {
    force = true;
 }
 compile ("com.google.firebase:firebase-messaging:11.4.2") {
    force = true;
 }
 compile ("com.google.firebase:firebase-perf:11.4.2") {
    force = true;
 }
 compile ("com.google.firebase:firebase-storage:11.4.2") {
    force = true;
 }
}

希望这会有所帮助