Unable to copy google-services.json.
See original GitHub issueI’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
-
Added fire base plugin to the project (
tns plugin add nativescript-plugin-firebase
) -
Created Firebase project (with correct project Id) on web and got the google-services.json file
-
Copied downloaded json file to app/App_Resources/Android folder.
-
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}));
-
executed command
tns run android
But it is giving following output:
Am I mistaken anything?
Issue Analytics
- State:
- Created 5 years ago
- Comments:23 (11 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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
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