androidreactjsreact-native

react native android/app/build.gradle file missing


I'm new to react native and I would like to create a simple app working with firebase push notifications.

So I've created my react app using 'expo init'

Now I'm stuck at point 2 of this tutorial https://github.com/invertase/react-native-firebase-docs/blob/master/docs/installation/android.md

In the tutorial, it says "apply xyz to your android/app/build.gradle" but the problem is that I have no such file, also in many other tutorials of react native this file is mentioned... do I have to create this file myself or should this file normally be created automatically?

To be more specific, I don't have an "android" directory. just many android folders in the node_modules folder

I've added a screenshot of my top-lvl folder structure.

folder structure


Solution

  • In Expo you have a 'managed' vs. 'bare' workflow (https://docs.expo.io/versions/v34.0.0/introduction/managed-vs-bare/)

    If you want to edit the gradle file you'll need to eject to a bare workflow:

    Unlike in the managed workflow where you don't touch the underlying native code directly, in this workflow the developer has complete control, along with the complexity that comes with that.

    If I remember correctly, you can use the CLI tools and just type 'expo eject'. The Android folder and all project files will then be created.