How to send push notification to react native android app using FCM - firebase

I am trying to build react native(0.59.9) android app with firebase push notification(FCM - ^16.2.4). I used this Doc https://github.com/evollu/react-native-fcm!
. After add google-service.json file and gradle dependencies , it gave errors.
Task :react-native-fcm:generateDebugBuildConfig FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-fcm:generateDebugBuildConfig'.
Unable to delete directory '.......\node_modules\react-native-fcm\android\build\generated\source\buildConfig\debug\com\evollu\react' after 10 attempts
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

I think you are going for a wrong component to install.
Of course first delete your current react-native-fcm component. Then it is enough to follow the steps below for installing firebase on react native:
https://rnfirebase.io/docs/v5.x.x/installation/initial-setup
and then continue with this link for configuration of android:
https://rnfirebase.io/docs/v5.x.x/installation/android
Also this link is a very good tutorial:
https://medium.com/#anum.amin/react-native-integrating-push-notifications-using-fcm-349fff071591

Related

Execution failed for task ':app:mergeDebugJavaResource'. - Gradle Task assemble

so I was trying to run my flutter project and then I got this error :
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> java.nio.file.FileSystemException: C:\Users\ASUS\Desktop\Programmin\Flutter\app_with_firebase\build\app\intermediates\merged_java_res\debug\out.jar: The process cannot access the file because it is being used by another process.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
Exception: Gradle task assembleDebug failed with exit code 1
I tried to do : File > Invalidate Chaches/Restart in Android studio, but it won't solve the problem. I also tried to do flutter clean, then flutter run, but It still shows me the same error.
I have no idea what to do now, any help is appreciated.
Thank you !
I did a bit more digging with SysInternals and jps and it turns out that the Kotlin Language Server wasn't releasing the lock on the build folder. For me, uninstalling the VS Code fwcd Kotlin extension (and replacing with a different Kotlin language extension, if required) was enough to fix the issue.
On Android Studio, all I can suggest is disabling/uninstalling the Kotlin plugin and seeing if that fixes it for you.

flutter firebase facebook login not working on android due to a build.gradle problem

it is working fine on iOS but facing this issue on android
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':firebase_auth:generateDebugRFile'.
Could not resolve all files for configuration ':firebase_auth:debugCompileClasspath'.
Could not find com.facebook.android:facebook-login:[8.1).
Required by:
project :firebase_auth
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 20s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
The version given by the facebook documentation doesn't work for me either.
That's the version i am actually using:
implementation 'com.facebook.android:facebook-login:[8,9)'
Anyway, if it doesn't solve your problem, try to give more information like, the plugin you are using for the facebook authentication, its version, and the firebase_auth and firebase_core version of the plugin you are using
It just worked with me when i switched to windows (don't know how ) and the error still show on Mac OS after trying all available solutions

Build Failing with an exception when adding firebase_auth or cloud_firestore in the pubspec.yaml file (firebase_core is working):

From the run terminal of android studio:
FAILURE: Build failed with an exception.
Where:
Script 'C:\Flutter\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 362
What went wrong:
A problem occurred configuring project ':cloud_firestore_web'.
Could not find method implementation() for arguments [project ':firebase_core'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Similar issue with firebase_auth.
Had a similar problem recently, here are the steps that fixed it for me.
Run flutter pub upgrade to upgrade all the Firebase plugins to the latest versions.
Use the steps at https://firebase.flutter.dev/docs/migration to check for any deprecated code.
In the android/build.gradle file, make sure the google services dependency is classpath 'com.google.gms:google-services:4.3.3' or whatever the latest version is.
In the android/app/build.gradle file, if you have any dependencies of the form
implementation 'com.google.firebase:[firebase-product:version-number] then get rid of those lines
Run flutter clean

flutter sqllite not woring

I m writing a flutter application and i m trying to learn using SQLite, as per document i added package in dependencies and run command to get it .
it gives error while compiling
dependencies:
flutter:
sdk: flutter
sqflite: ^1.1.5
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
i m expecting application to run but it gives error
PS D:\my\flutter\snapexpense_new> flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 1.2s
Resolving dependencies... 3.8s
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':sqflite:lintClassPath'.
> Could not download kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.2.1/kotlin-compiler-26.2.1.jar'.
> Connection reset
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Running Gradle task 'assembleDebug'... Done 120.2s (!)
Gradle task assembleDebug failed with exit code 1
The day I was also with this problem but fortunately I settled after a lot of research time.
First step
you must download kotlin-compiler.jar
Second step
Open your project flutter go to the folder that is in the image above and paste the kotlin-compiler.jar
After all this done open your flutter project and update your dependencies, and when you finish back to run application.
For me it worked hope it works for you too.

Ionic blank project's build failed after adding mfp-push plugin

create an blank ionic project and added mfp and mfp-push plugins. Tried to build and got this error:
BUILD FAILED in 41s
Error: cmd: Command failed with exit code 1 Error output:
C:\Users\saikmeda\TestFbSdk\platforms\android\app\src\main\java\com\ibm\mobilefirstplatform\clientsdk\cordovaplugins\push\CDVMFPPush.java:100: error: cannot access FirebaseInstanceIdService
MFPPush.getInstance().initialize(this.cordova.getActivity().getApplicationContext(), timeout);
^
class file for com.google.firebase.iid.FirebaseInstanceIdService not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 41s
The latest MFP 8.0 client side iFix for Android has been modified to work with FCM completely. The error message you see is coming because there are some changes needed in your Android project - specifically around removing GCM classes and modifying for FCM.
Follow the instructions in the link to get your project working:
http://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/handling-push-notifications/android/#migrate-to-fcm
Now, all this is required only if you use MFP's push feature. If you do not , you can remove cordova-plugin-mfp-push plugin from your project and rebuild it.

Resources