React Native application using Firebase

2
Hello, I'm creating an application using React Native, and trying to integrate with Firebase, I found a starter project application, which already has the integration ready, only needing to add google-services.json to the root directory of the android application, android/app , I followed all the steps of which are described in the Repository Readme, which is located at the following URL:

link

After that, and done all the described steps to start the project, I made the entry of the following command in the console, so that the project started: npm run android , from which I get the following error:

   > Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Task :app:processDebugGoogleServices FAILED
Parsing json file: C:\Development\react-native-firebase-starter\android\app\google-services.json


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> No matching client found for package name 'com.unisul.testcar'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
16 actionable tasks: 1 executed, 15 up-to-date
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
    
asked by anonymous 26.06.2018 / 03:19

1 answer

3

Try using Firebase in this way:

  • Go to link
  • Go to Console and create a new project
  • Once the project has been created, choose to add "Authentication" for example. Under "Login Method", choose "Email / Password" or any other of your choice
  • When you do this, in the upper right corner, go to "Web Configuration" to get your credentials and paste it into your App.js, for example:

    class App extends Component {
        componentWillMount() {
        const firebase = require('firebase');
    
        const config = {
          apiKey: 'xxxx',
          authDomain: 'xxxx',
          databaseURL: 'xxxx',
          projectId: 'xxxx',
          storageBucket: 'xxxx',
          messagingSenderId: 'xxxx'
        };
        firebase.initializeApp(config);
    }
    
  • Install Firebase dependency into your project using npm:

        npm install --save firebase
    

    Test and see if it works.

        
    29.07.2018 / 00:47