安装Pushwoosh包后,React Native应用程序关闭

时间:2017-11-24 18:26:36

标签: firebase react-native google-analytics pushwoosh

我在一个干净的应用程序中测试了该软件包并且工作正常,但是当我尝试将 pushwoosh-react-native-plugin 添加到现有应用程序时,它会在启动时关闭并且永远不会触发错误在Firebase崩溃报告中。

我怀疑可能与 react-native-google-analytics-bridge react-native-firebase 包有冲突,但无法解决任何问题。

该应用程序在Android和iPhone模拟器中崩溃。

这是 my packages.json 文件的内容:

2017-11-24 18:05:40 =CRASH REPORT====
  crasher:
    initial call: httpc_handler:init/1
    pid: <0.522.0>
    registered_name: []
    exception error: bad argument: [{erlang,length,[[100,101,118,105,99,101,84,111,107,101,110,61,<<"dy....[Very long FCM token]...Kn4b1">>,38,115,101,110,100,101,114,61|<<"epeued7o3z">>]],[]},{httpc_request,body_length,1,[{file,"httpc_request.erl"},{line,233}]},{httpc_request,post_data,4,[{file,"httpc_request.erl"},{line,208}]},{httpc_request,send,4,[{file,"httpc_request.erl"},{line,85}]},{httpc_handler,connect_and_send_first_request,3,[{file,"httpc_handler.erl"},{line,815}]},{httpc_handler,init,1,[{file,"httpc_handler.erl"},{line,238}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]
    ancestors: [httpc_handler_sup,httpc_sup,inets_sup,<0.439.0>]
    message_queue_len: 0
    messages: []
    links: [<0.445.0>,#Port<0.14269>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 610
    stack_size: 27
    reductions: 978
  neighbours:
2017-11-24 18:05:40 =SUPERVISOR REPORT====
     Supervisor: {local,httpc_handler_sup}
     Context:    child_terminated
     Reason:     {badarg,[{erlang,length,[[100,101,118,105,99,101,84,111,107,101,110,61,<<"dy...[Very long FCM token].....Kn4b1">>,38,115,101,110,100,101,114,61|<<"epeued7o3z">>]],[]},{httpc_request,body_length,1,[{file,"httpc_request.erl"},{line,233}]},{httpc_request,post_data,4,[{file,"httpc_request.erl"},{line,208}]},{httpc_request,send,4,[{file,"httpc_request.erl"},{line,85}]},{httpc_handler,connect_and_send_first_request,3,[{file,"httpc_handler.erl"},{line,815}]},{httpc_handler,init,1,[{file,"httpc_handler.erl"},{line,238}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
     Offender:   [{pid,<0.522.0>},{id,undefined},{mfargs,{httpc_handler,start_link,undefined}},{restart_type,temporary},{shutdown,4000},{child_type,worker}]

这是 android / build.gradle 中的依赖项:

    {
    "name": "Myapp",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "MD5": "^1.3.0",
        "moment": "^2.18.1",
        "native-base": "^2.3.2",
        "pushwoosh-react-native-plugin": "^3.1.0",
        "react": "16.0.0-alpha.12",
        "react-native": "0.48.3",
        "react-native-fetch-blob": "^0.10.8",
        "react-native-firebase": "^3.0.3",
        "react-native-google-analytics-bridge": "^5.3.3",
        "react-native-htmlview": "^0.12.0",
        "react-native-img-cache": "^1.4.0",
        "react-native-offline": "^3.1.1",
        "react-native-progress": "^3.4.0",
        "react-native-timeago": "^0.3.0",
        "react-native-video": "^2.0.0",
        "react-navigation": "^1.0.0-beta.11",
        "rn-placeholder": "^1.0.1"
    },
    "devDependencies": {
        "babel-jest": "21.0.2",
        "babel-preset-react-native": "4.0.0",
        "jest": "21.1.0",
        "react-test-renderer": "16.0.0-alpha.12"
    },
    "jest": {
        "preset": "react-native"
    }
}

1 个答案:

答案 0 :(得分:0)

我刚刚按照本文中详述的确切步骤修正了错误:https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f添加以下行:

compile("com.google.android.gms:play-services-gcm:11.4.2"){
            force = true
        }
        compile("com.google.android.gms:play-services-location:11.4.2"){
            force = true
        }

这是我的最终 android / app / build.gradle

dependencies {

    compile (project(':pushwoosh-react-native-plugin'))
    {
      exclude group: 'com.google.android.gms'
    }
    compile (project(':react-native-google-analytics-bridge'))
    {
      exclude group: 'com.google.android.gms'
    }
    compile(project(':react-native-firebase')) {
        transitive = false
        exclude group: 'com.google.android.gms'
    }
    compile ("com.google.android.gms:play-services-base:11.4.2"){
        force = true;
    }
    compile("com.google.android.gms:play-services-analytics: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-location:11.4.2"){
        force = true
    }
    compile ("com.google.firebase:firebase-core:11.4.2"){
        force = true;
    }
    compile 'com.google.firebase:firebase-crash:11.4.2'
    compile "com.google.firebase:firebase-analytics:11.4.2"
    compile project(':react-native-fetch-blob')
    compile project(':react-native-video')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:26.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}