gradle sync failed caused: java.lang.NullPointerException
The steps below helped me get out of this situation:
- File -> Invalidate Caches / Restart -> Invalidate and Restart
- Build -> Clean Project
Hope that helps!
I ran into this issue when opening a React Native project incorrectly.
To fix this, I:
- File > Close Project
- Removed Project from the Welcome screen (cosmetic and not to get me into this mess again)
- Chose > Import project (Gradle, Eclipse, ADT, etc.)
- Chose my
react-native-app-folder/android
After doing this, all errors were gone.
The problem was resolved for me , after I made a fresh installation of studio.
For this
Step 1. Uninstall Android Studio. While uninstalling please make sure that you selected the additional option Android User Settings also.
Step 2. Goto user's home folder and delete folders .gradle, .AndroidStudiox.x(if it's still there). No need to delete or rename or relocate Workspace fodler.
Step 3. Now install android studio again.
Step 4. Let it download and build gradle.
Step 4. DONE.. :D