Check out example codes for "Error: Gradle project sync failed. Please fix your project and try again.". It will help you in understanding the concepts better.

Code Example 1

Goto File -> Invalidate caches / Restart.
Shutdown Android Studio.
Rename/remove .gradle folder in the user home directory.
Restart Android Studio (It will download gradle metadata and data)
Gradle build succeed.
Rebuild project.

Learn ReactJs, React Native from