My Gradle sync fails with the following error message in the log:
Gradle sync failed: java.lang.NoSuchMethodError: com.android.builder.model.AndroidProject.getProjectType()I
or sometimes I get this error instead:
Gradle sync failed: com.android.builder.model.AndroidProject.getProjectType()I
And this error pop up (The yellowish box that pops up at top of the gradle file in android studio):
Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly.
I had the same issue a few days earlier, but I just clicked file/Invalid Caches/restart and the Gradle sync succeded.However, the gradle fail has returned again today.
I have tried everything suggested here in this post and other SO posts but nothing seem to work, the error is still there.
Is there any suggestions on other things I can try to fix this error?