application getting exit whenever i am trying to sending notification in react native project #7510
Replies: 2 comments 1 reply
-
The formatting here is very difficult to read. triple-backticks and a language-specifier is how you do it There is never a need to do this and it may cause problems:
also implementation platform('com.google.firebase:firebase-bom:32.7.0')
implementation('com.google.firebase:firebase-analytics')
implementation('com.google.firebase:firebase-messaging') I'm not sure why are you directly depending on those when the module files from this package do it for you, nor am I sure why you specify a BOM here (using our use at your own risk override mechanism https://rnfirebase.io/#overriding-native-sdk-versions ) but I'll assume you have your reasons. If things break when you do that, you need to not do that though - I would suggest removing all four of the lines I've just mentioned here Finally, you say "application getting exit" but you have not posted any stack trace indicating what the crash was and why it is from this project. You should use |
Beta Was this translation helpful? Give feedback.
-
i removed these three line and i attached debugger now i am getting this error |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
application getting exit whenever i am trying to sending notification in react native project
react-native-firebase/messaging
i am using this package "@react-native-firebase/messaging": "^18.7.3"
// Top-level build file where you can add configuration options common to all sub-projects/modules.
./android/build.gradle
`buildscript {
ext {
firebaseMessagingVersion:"21.1.0"
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
}`
./android/app/build.gradle
`apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: 'com.google.gms.google-services' // <- Add this line
/**
This is the configuration block to customize your React Native Android app.
By default you don't need to apply any configuration, just uncomment the lines you need.
/
react {
/ Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
// root = file("../")
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
// reactNativeDir = file("../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
// codegenDir = file("../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// cliFile = file("../node_modules/react-native/cli.js")
/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
// debuggableVariants = ["liteDebug", "prodDebug"]
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
//
// The command to run when bundling. By default is 'bundle'
// bundleCommand = "ram-bundle"
//
// The path to the CLI configuration file. Default is empty.
// bundleConfig = file(../rn-cli.config.js)
//
// The name of the generated asset file containing your JS bundle
// bundleAssetName = "MyApplication.android.bundle"
//
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
// entryFile = file("../js/MyApplication.android.js")
//
// A list of extra flags to pass to the 'bundle' commands.
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
// extraPackagerArgs = []
/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
}
/**
*/
def enableProguardInReleaseBuilds = false
/**
def jscFlavor = 'org.webkit:android-jsc-intl:+'
Date.toLocaleString
andString.localeCompare
that*/
def jscFlavor = 'org.webkit:android-jsc:+'
android {
ndkVersion rootProject.ext.ndkVersion
}
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
}
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)`
MainApplication.java
`package com.digianafresh;
import android.app.Application;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.soloader.SoLoader;
import io.invertase.firebase.app.ReactNativeFirebaseAppPackage;
// import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
import com.google.firebase.messaging.FirebaseMessaging;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new DefaultReactNativeHost(this) {
};
@OverRide
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@OverRide
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for
// this app.
DefaultNewArchitectureEntryPoint.load();
}
ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
// FirebaseApp.initializeApp(this);
}
}`
AndroidManifest.xml
`
`
Beta Was this translation helpful? Give feedback.
All reactions