react native android/app/build.gradle file missing

百般思念 提交于 2021-02-08 20:54:14

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/57349213/react-native-android-app-build-gradle-file-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!