vtisnado
vtisnado

Reputation: 500

React Native app closes after installing Pushwoosh package

I tested the package in a clean app and it works fine, however when I try to add pushwoosh-react-native-plugin to an existing app, it closes on start and never fire an error in Firebase Crash Reporting.

I suspect may be a conflict with react-native-google-analytics-bridge or react-native-firebase packages, but can't fine anything.

The app crashes in the Android and iPhone emulators.

This is the content of my packages.json file:

    {
    "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"
    }
}

This are the dependencies in my android/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.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
}

Upvotes: 1

Views: 182

Answers (1)

vtisnado
vtisnado

Reputation: 500

I just fixed the error following the exact steps detailed in this article: https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f adding this lines:

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
        }

This is my final 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
}

Upvotes: 0

Related Questions