Gradle sync failed: com.android.builder.model.Andr

2019-07-28 06:00发布

问题:

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?

回答1:

Delete after backup folder C:\Program Files\Android\Android Studio and unzip Beta Android Studio zip file into that folder. Hope it help!



回答2:

I have managed to get rid of this problem now. It seems it had something to do with the latest Android Studio.

I downloaded 2.3 Beta 1 from the Canary Channel, and that's where the problem was.

I went back to using 2.3 Canary 3 from the Canary Channel, and now it works fine.