简体   繁体   中英

React native push notification

I am working on react native push notification and configuring fcm in my build.gradle file

I am getting error

> Task :react-native-device-info:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-device-info\android\src\main\java\com\learnium\RNDeviceInfo\RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-fcm:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-fcm\android\src\main\java\com\evollu\react\fcm\SendNotificationTask.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-i18n:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-i18n\android\src\main\java\com\AlexanderZaytsev\RNI18n\RNI18nModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-video:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-video\android\src\main\java\com\brentvatne\react\ReactVideoViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

here it is app/build.gradle configuration

dependencies {

  compile project(':react-native-fcm')
    compile 'com.google.firebase:firebase-core:10.0.1' //this decides your firebase SDK version
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile project(':react-native-config')
    compile project(':react-native-sound')
    compile project(':react-native-vector-icons')
    compile project(':react-native-video')
    compile project(':react-native-file-chooser')
    compile project(':react-native-audio')
    compile project(':react-native-image-picker')
    compile project(':react-native-i18n')
    compile project(':react-native-device-info')
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.facebook.react:react-native:+'
}

and android build.gradle file is

dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        // PLEASE DO NOT CHANGE GRADLE VERSION
         classpath 'com.google.gms:google-services:3.2.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

help me how to resolve it

This is the conflict of android jar library.

It is common error. You need exclude module or something? I can't answer your question, because It is few information about your error.

What I want to say is react-native-device-info and react-native-fcm very often conflict!. (the two library use same jar file.) try search exclude module or force in build.gradle.

And, react-native-firebase is better fcm library than react-native-fcm. Try it.

Read it! How to solve Google Play Services version collision in gradle dependencies https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f

Welcome to React Native!!!

did you try jetify ?

   First, use Android Studio's refactoring tool to convert your app re: the Android developer docs
    npm install --save-dev jetifier
    npx jetify
    npx react-native run-android (your app should correctly compile and work)
    Call npx jetify run in the postinstall target of your package.json (Any time your dependencies update you have to jetify again)

For more informations :

jetify

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM