So I just created a react native project using the command
react-native init "project-name"
I went into the app level build.gradle to connect firebase and I had an error saying could not resolve symbol 'android' on the line
import com.android.build.OutputFile
However, it popped up saying "android framework is detected in the project click to configure" so I did this, but then it said cannot resolve symbol 'build' on the same line, I have no idea why it's saying this as I have made the project the same way before and never had this problem, any ideas?
Most often “R cannot be resolved” error appears if there is an issue with some of your resource files. Due to this error, you are unable to build your application. That's why we need to solve this error as it not getting away by just doing a simple restart or hitting Alt+Enter.
Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.
In my case I was able to solve this by following those steps:
// import com.android.build.OutputFile
import com.android.build.OutputFile
This might not work for everybody. In my case said import worked until I changed something somewhere in the project and suddenly the import failed. If the import never worked for you, this might not be the solution, but otherwise worth a try.
the thing that worked for me was
1- replace this line in build.gradle(:app)
def abi = output.getFilter(OutputFile.ABI)
with:
def abi = output.getFilter(com.android.build.OutputFile.ABI)
2- and click on sync project with gradle files (the elephant with blue arrow)
Try double click on build word in your code such as Build.VERSION, not in the import com.android.build.OutputFile
. then if it show press ALT + Enter, you should do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With