简体   繁体   English

在React Native中使用FCM推送通知

[英]Push notification using fcm in react native

I am working on react native push notification sample example . 我正在研究本地推送通知示例示例。 i am getting error to build the app . 我在构建应用程序时出错。

Error is ... 错误是...

:app:processDebugGoogleServices
Parsing json file: E:\REACT-NATIVE\fcmreactnative\android\app\google-services.json
:app:processDebugGoogleServices FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> Failed to delete: E:\REACT-NATIVE\fcmreactnative\android\app\build\generated\res\google-services\debug

I am using android build.gradle with version 我正在使用带有版本的android build.gradle

dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        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
    }

and android/app/build.gradle

dependencies {
     compile project(':react-native-fcm')
    compile 'com.google.firebase:firebase-core:10.0.1' 
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:24.2.1"
    compile "com.facebook.react:react-native:+"  // From node_modules

}

please help me how to resolve it.. 请帮助我如何解决它。

in firebase console,you can: Firebase控制台中,您可以:

for Android: download google-services.json file and place it in android/app directory
for iOS: download GoogleService-Info.plist file and place it in /ios/your-project-name directory (next to your Info.plist)

Make sure you have certificates setup by following https://firebase.google.com/docs/cloud-messaging/ios/certs 通过遵循https://firebase.google.com/docs/cloud-messaging/ios/certs确保已设置证书

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

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