react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

App crash on startup

Open VincenzoCarlino opened this issue 8 years ago • 16 comments

#927 I have installed react-native-push-notification and in android my project builds but it doesn't start.

VincenzoCarlino avatar Oct 31 '18 14:10 VincenzoCarlino

+1 described in: #910

martingalovic avatar Nov 01 '18 10:11 martingalovic

+1

hoanghuy27297 avatar Nov 02 '18 03:11 hoanghuy27297

+1

copand avatar Nov 05 '18 16:11 copand

Im getting this issue as well. I have no issues until i add google-maps capabilities to the application.

Before this remote and local notifications work completely as intended. With the addition it crashes immediately.

builtbyproxy avatar Nov 06 '18 06:11 builtbyproxy

hi @Vincenzo1997, i am getting same crash report, did you resolve this issue?

harikanammi avatar Nov 20 '18 07:11 harikanammi

I have fixed the issue for me, im not sure if this is of any use to you but my react-native link added the react-native-push-notification files multiple times to my gradle and .java files.

Keep an eye out for this, if you have a commit where you know it worked try running just react-native link react-native-push-notification only

This worked for me. I realise its specific to my case but hopefully this simple fix helps someone!

builtbyproxy avatar Nov 20 '18 23:11 builtbyproxy

I have started to get the same issue after upgrading version to 3.1.2, try to configure again but it just crashes immediately after I build the app. Could not solve the issue

naimmustafa avatar Dec 11 '18 14:12 naimmustafa

I have removed this lib and just use react-native-firebase

hoanghuy27297 avatar Dec 12 '18 12:12 hoanghuy27297

+1

baotoan1905 avatar Dec 14 '18 02:12 baotoan1905

@hoanghaihuy , I have removed "react-native-firebase" and install this library, because "react-native-firebase" require too many changes in native side of project and build requirements, and since that it incompatible with lot of other libraries in my project. So please do not mislead people - "react-native-firebase" is really great project, but it not replacement for this library

Zaporozhec7 avatar Dec 30 '18 13:12 Zaporozhec7

@Zaporozhec7 yes, you're right. react-native-firebase cannot replace for this lib. And I just talked about my own solution to solve this problem which have not been solved through bunch of similar issues.

hoanghuy27297 avatar Dec 30 '18 14:12 hoanghuy27297

i think i finde my problem,,, im using react-native-maps and react-native-push-notification. in react native project. when i link bouth at sime time my app crash before start. according to documentation https://github.com/zo0r/react-native-push-notification play-service-gcm and firebase-messaging, prior to version 15 requires to have the same version number in order to work correctly at build time and at run time. To use a specific version: i change my build.gradle dependencis in react-native-push-notification. from def firebaseVersion = project.hasProperty('firebaseVersion') ? project.firebaseVersion : DEFAULT_FIREBASE_MESSAGING_VERSION to def firebaseVersion = project.hasProperty('firebaseVersion') ? project.firebaseVersion : '11.8.0' and i add i android/build.gradle googlePlayServicesVersion = "11.8.0", same version

buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.3' } }

allprojects { repositories { jcenter() } }

apply plugin: 'com.android.library'

def DEFAULT_COMPILE_SDK_VERSION = 27 def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3" def DEFAULT_TARGET_SDK_VERSION = 27 def DEFAULT_SUPPORT_LIB_VERSION = "27.1.1" def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+" def DEFAULT_FIREBASE_MESSAGING_VERSION = "+"

android { compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION

defaultConfig {
    minSdkVersion 16
    targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies { def supportLibVersion = project.hasProperty('supportLibVersion') ? project.supportLibVersion : DEFAULT_SUPPORT_LIB_VERSION def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION def firebaseVersion = project.hasProperty('firebaseVersion') ? project.firebaseVersion : '11.8.0' // DEFAULT_FIREBASE_MESSAGING_VERSION

compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:$supportLibVersion"
compile 'com.facebook.react:react-native:+'
compile "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
compile 'me.leolin:ShortcutBadger:1.1.8@aar'
compile "com.google.firebase:firebase-messaging:$firebaseVersion"

}

android/buiild.gradle // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript { ext { // firebaseVersion=16 googlePlayServicesVersion = "11.8.0" buildToolsVersion = "27.0.3" minSdkVersion = 16 compileSdkVersion = 27 targetSdkVersion = 26 supportLibVersion = "27.1.1" } repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.4'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects { repositories { mavenLocal() google() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } } }

task wrapper(type: Wrapper) { gradleVersion = '4.4' distributionUrl = distributionUrl.replace("bin", "all") }

omerinjo avatar Feb 01 '19 23:02 omerinjo

I also had the same issue in react-native: 0.57.8. But worked perfect in react-native: 0.58.5. That issue was resolved by adding googlePlayServicesVersion = "+" firebaseVersion = "+" in android/build.gradle as mentioned in documentation

jayan2019 avatar Feb 26 '19 10:02 jayan2019

I had the same issue, I tried to add these lines :

googlePlayServicesVersion = "+"
firebaseVersion = "+"

But I faced the same problem. I checked my app/build.gradle to get correct version numbers :

    implementation "com.google.android.gms:play-services-base:16.1.0"
    ...
    implementation "com.google.firebase:firebase-messaging:17.5.0"

I modified the version numbers on android/build.gradle

googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.5.0"

And my app started :)

Linoa65 avatar May 14 '19 16:05 Linoa65

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 23 '20 00:05 github-actions[bot]

lkflkflfkflkf

LPoussin avatar May 26 '20 16:05 LPoussin