首页 > 解决方案 > 反应原生推送通知

问题描述

我正在处理本机推送通知并在我的 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
    }

帮我解决它

标签: reactjs

解决方案


你试过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)

欲了解更多信息:

喷射化


推荐阅读