简体   繁体   English

反应本机推送通知

[英]React native push notification

I am working on react native push notification and configuring fcm in my build.gradle file我正在处理本机推送通知并在我的 build.gradle 文件中配置 fcm

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这是 app/build.gradle 配置

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和android build.gradle文件是

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.这是android jar库的冲突。

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!.我想说的是 react-native-device-info 和 react-native-fcm 经常冲突!。 (the two library use same jar file.) try search exclude module or force in build.gradle. (这两个库使用相同的 jar 文件。)尝试在 build.gradle 中搜索排除模块或强制。

And, react-native-firebase is better fcm library than react-native-fcm.而且,react-native-firebase 是比 react-native-fcm 更好的 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如何解决 gradle 依赖项中的 Google Play 服务版本冲突https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f

Welcome to React Native!!!欢迎使用 React Native!!!

did you try jetify ?你试过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喷射

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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