反应原生推送通知

时间:2018-05-18 12:45:32

标签: reactjs

我正在研究本机推送通知并在build.gradle文件中配置fcm

我收到错误

> 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.

这里是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:+'
}

和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
    }

帮我解决问题

2 个答案:

答案 0 :(得分:0)

这是android jar库的冲突。

这是常见的错误。 你需要排除模块或什么? 我无法回答你的问题,因为关于你的错误的信息很少。

我想说的是react-native-device-info和react-native-fcm经常发生冲突! (这两个库使用相同的jar文件。) 尝试在build.gradle中搜索排除模块或强制。

而且,react-native-firebase比react-native-fcm更好的fcm库。 试试吧。

阅读它! 如何解决gradle依赖项中的Google Play服务版本冲突问题 https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f

欢迎来到React Native !!!

答案 1 :(得分:0)

您尝试喷射吗?

   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)

有关更多信息:

jetify