question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to copy google-services.json.

See original GitHub issue

I’m new to Nativescript and trying to configure Firebase in my app.

I’m using nativescript 3.3.1 version

These are the steps I followed

  1. Added fire base plugin to the project (tns plugin add nativescript-plugin-firebase)

  2. Created Firebase project (with correct project Id) on web and got the google-services.json file

  3. Copied downloaded json file to app/App_Resources/Android folder.

  4. Added following code to app.component.ts file import firebase = require('nativescript-plugin-firebase'); firebase.init() .then(() => console.log('Firebase initialized!!!')) .catch(error => console.log(Failed to initialize Firebase ${error}));

  5. executed command tns run android

But it is giving following output: typescript_error

Am I mistaken anything?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:23 (11 by maintainers)

github_iconTop GitHub Comments

7reactions
Burgovcommented, May 21, 2018

@EddyVerbruggen that would be because I’m too impatient to read documentation… Thanks for your quick response.

https://github.com/EddyVerbruggen/nativescript-plugin-firebase/pull/716

4reactions
Tukkancommented, Jul 11, 2018

The problem is in hooks/after-prepare/firebase-copy-google-services.js line 10.

var destinationGoogleJson = path.join($projectData.platformsDir, "android", "app", "google-services.json");

platforms/android doesn’t have app folder and that is why the hook is failing.

Correct me if I’m wrong but the google-services.json should be in platforms/android, not in platforms/android/app folder.

Changing

var destinationGoogleJson = path.join($projectData.platformsDir, "android", "app", "google-services.json");

to

var destinationGoogleJson = path.join($projectData.platformsDir, "android", "google-services.json");

fixes the problem. App builds correctly and gradle is not complaining about lack of google-services.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error "File google-services.json is missing from module root ...
Under projects-settings, we need to ADD APP and it will generate a google-services.json file that can be downloaded and added to <appName>/ ...
Read more >
Error File google-services json is missing from module root ...
Your answer · Select your project · On the left menu, click on settings > project settings · Add an app or download...
Read more >
How to correct file Google services JSON is missing - YouTube
Let's take a look at this error: file google services JSON is missing. The Google services plugin ... Your browser can't play this...
Read more >
The Google Services Gradle Plugin
Process the google-services.json file and produce Android resources that can be used in your application's code. See Adding the JSON File more information....
Read more >
Unable to download google-services.json using Google Apps ...
> This is a bug in Chrome browser. You can download google-services.json file from some other browser e.g Microsoft edge or Mozilla etc....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found