Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs inconsistency about the location of apply plugin: 'com.google.gms.google-services' #3875

Closed
andersonaddo opened this issue Jul 4, 2020 · 2 comments · Fixed by #3876
Closed

Comments

@andersonaddo
Copy link
Contributor

andersonaddo commented Jul 4, 2020

I was just integrating the new Crashlytics SDK (#3580) into my project, and I ran into this little docs inconsistency.

When setting up the /app module, the docs state that apply plugin: 'com.google.gms.google-services' should be placed at the very bottom of the /android/app/build.gradle file.

However, in the new setup docs for Crashlytics, that command is actually placed at the top instead. Clearly, order does matter, since apply plugin: 'com.google.gms.google-services' is always placed after apply plugin: 'com.android.application', and apply plugin: 'com.google.firebase.crashlytics' is meant to be placed after apply plugin: 'com.google.gms.google-services' (wherever that may be).

So what there a reason the docs seemed so insistent that it should be at the bottom? I didn't get any build errors when I moved it to the top

@andersonaddo
Copy link
Contributor Author

I've looked at StackOverflow and it looks like the firebase docs used to specify that they should be at the bottom. Example 1, Example 2.

They don't anymore, though, so I guess maybe our docs are outdated.

@mikehardy
Copy link
Collaborator

I may be wrong about the root cause but I think if you don't get this correct, you'll see this with current versions of react-native-firebase that are checking for google API availability:

/home/mike/work/Kullki/ksocialscore/packages/public-app/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/utils/ReactNativeFirebaseUtilsModule.java:29: error: cannot find symbol
import com.google.android.gms.common.GoogleApiAvailability;
                                    ^
  symbol:   class GoogleApiAvailability
  location: package com.google.android.gms.common
/home/mike/work/Kullki/ksocialscore/packages/public-app/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/utils/ReactNativeFirebaseUtilsModule.java:80: error: cannot find symbol
    GoogleApiAvailability gapi = GoogleApiAvailability.getInstance();
    ^
  symbol:   class GoogleApiAvailability
  location: class ReactNativeFirebaseUtilsModule
/home/mike/work/Kullki/ksocialscore/packages/public-app/node_modules/@react-native-firebase/app/android/src/reactnative/java/io/invertase/firebase/utils/ReactNativeFirebaseUtilsModule.java:80: error: cannot find symbol
    GoogleApiAvailability gapi = GoogleApiAvailability.getInstance();

I got those android compile errors at any rate, remembered this issue and moved the plugin up, then it seemed to work - I may only be describing a tangential problem but the correlation is strong 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants