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.

Brand new capacitor app requires google-services.json

See original GitHub issue

Summary: After creating a new ionic app and adding in capacitor to it, the app will not build in android studio because it requires google-services.json (a firebase config file).

Steps to Reproduce: ionic start test tabs --type=angular cd test ionic build npm install --save @capacitor/cli @capacitor/core npm uninstall --save cordova-plugin-splashscreen npx cap init Test com.example.test npx cap add android npx cap open android

Expected Results The app should build and run in android studio without needing a google-services.json file.

Actual Results

File google-services.json is missing. The Google Services Plugin cannot function without it. 
 Searched Location: 
C:\code\test\android\app\src\nullnull\debug\google-services.json
C:\code\test\android\app\src\debug\nullnull\google-services.json
C:\code\test\android\app\src\nullnull\google-services.json
C:\code\test\android\app\src\debug\google-services.json
C:\code\test\android\app\src\nullnullDebug\google-services.json
C:\code\test\android\app\google-services.json

Ionic:

ionic (Ionic CLI) : 4.0.6 (C:\Users\Joe\AppData\Roaming\npm\node_modules\ionic) Ionic Framework : @ionic/angular 4.0.0-beta.2 @angular-devkit/core : 0.7.3 @angular-devkit/schematics : 0.7.3 @angular/cli : 6.1.3 @ionic/ng-toolkit : 1.0.6 @ionic/schematics-angular : 1.0.4

System:

NodeJS : v8.11.3 (C:\Program Files (x86)\nodejs\node.exe) npm : 5.5.1 OS : Windows 10

Capacitor: 1.0.0-beta.4

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
jcesarmobilecommented, Aug 14, 2018

For people facing this, the PR will only affect new apps as the change is on the template. You can replace the current apply with this in the build.gradle if you don’t use push but plan to do it in the future

try {
    def servicesJSON = file('google-services.json')
    if (servicesJSON.text) {
        apply plugin: 'com.google.gms.google-services'
    }
} catch(Exception e) {
    logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}

If don’t plan on using it, remove it as @daniel-lucas-silva said

4reactions
daniel-lucas-silvacommented, Aug 11, 2018

remove apply plugin: ‘com.google.gms.google-services’ implementation ‘com.google.firebase:firebase-messaging:17.1.0’ classpath ‘com.google.gms:google-services:4.0.1’

from android/build.gradle and android/app/build.gradle

i want to know why cap is adding firebase to the project

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ionic 4 + Capacitor google-services.json searched under ...
I am trying to compile a ionic 4 + capacitor app on Android. In order to get the build working, I had to...
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 >
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 >
Using Push Notifications with Firebase in an Ionic Angular App
The next prompt will ask you to download a google-services.json file. This file contains the information your Capacitor app needs to connect to...
Read more >
@capacitor/push-notifications - npm
There is no need to add the Firebase SDK to your app or edit your app manifest - the Push Notifications provides that...
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