Android Studio 3.1 Canary 3 - Gradle sync failed

2020-02-05 06:05发布

For a unknown reason Android Studio 3.1 Canary 3 is bugged and stopped to work, I updated gradle to 3.1-alpha03 and it stopped working, no matter if I download the project again, already downloaded Android Studio again too.

I've already checkout old versions of the project, but this message still show:

Gradle sync failed: com.android.tools.idea.gradle.project.model.AndroidModuleModel.getSelectedVariant()Lcom/android/tools/idea/gradle/project/model/ide/android/IdeVariant; (8s 806ms)

I've removed .idea folder, .gradle folder, did invalidate and restart

I don't know nothing more to do, cant run or use the IDE.


Edit:

Image


Edit2:

New Projects doesnt work too

8条回答
ら.Afraid
2楼-- · 2020-02-05 06:35

It's a problem with Kotlin 1.1.60-release-Studio3.0-1 plugin.

Uninstall it from Android Studio and fetch an older version from here: https://plugins.jetbrains.com/plugin/6954-kotlin

查看更多
干净又极端
3楼-- · 2020-02-05 06:37

Try to download and install this kotlin plugin for android studio 3.1

查看更多
叼着烟拽天下
4楼-- · 2020-02-05 06:38

I encountered the same problem after upgrading to:

Android Studio 3.2 Canary 10
Build #AI-181.2784.17.32.4705630, built on April 6, 2018
JRE: 1.8.0_152-release-1136-b02 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.13.4

& Kotlin plugin 1.2.31

I uninstalled the Kotlin plugin

File | Invalidate Cache and restart

Reinstalled the latest Kotlin plugin 1.2.31

File | Invalidate Cache and restart

Everything is now okay.

查看更多
神经病院院长
5楼-- · 2020-02-05 06:40

Faced same problem after upgrading to Android Studio 3.1 stable.

Kotlin plugin version was 1.2.30-release-Studio3.1-1

So manually upgraded to,

1.2.31-release-Studio3.1-1

and boom, problem solved.

In short, try upgrading to most relevant plugin to fix gradle sync failure.

查看更多
Deceive 欺骗
6楼-- · 2020-02-05 06:45

solved:

first run -> find ~ -path ~/Library/Caches/Metadata/Safari -prune -o -iname \*android\*studio\* -print -prune

DELETE ALL FOLDERS related to android-studio

start fresh install and project setup

查看更多
够拽才男人
7楼-- · 2020-02-05 06:46

To solve this issue, you have to either upgrade or downgrade your kotlin plugin

Solution 1: Upgrade Plugin

First go to Tools menu > Select Kotlin > Configure Kotlin Plugin Updates > Select one of the kotlin plugin & press download (stable or early access, i chose early access to solve this issue)

And finally change the kotlin version in build.gradle(Project:) according to the downloaded version


enter image description here

Solution 2: Downgrade Plugin

If your on mac then press: Command + , to open preference, then select plugin & search for kotlin & uninstall it, it will rollback to previous version: 1.1.51

On Windows machine, press Control + Alt + S to open settings dialog, then select plugins & search for kotlin & uninstall it, it will rollback to previous version: 1.1.51

enter image description here

Please Note: Do not uncheck kotlin in plugins else it will disable kotlin & fail to recognise kotlin file & syntax

查看更多
登录 后发表回答