In android studio,cannot load 2 facets-unknown fac

2020-01-27 12:29发布

When I open android studio I am getting an error- "Error loading project: Cannot load 2 facets. When I clicked to see the error the following appeared

"2 facets cannot be loaded. You can mark them them as ignored to suppress this error notification. Unknown facet type:'android', Unknown facet type:'android-gradle'

I tried to add facets ( In Project Structure > Project settings > Modules > clicked project name, then clicked Android as well as Android-Gradle) But both showed as "cannot load facet, unknown facet type." Under Project settings > Facets > both Android and Android-Gradle are displayed as 'Invalid facets'. My project was running smoothly. This problem occured when I force-closed my laptop before exiting android studio as everything got stuck. After that whenever I open the android studio this problem occurs. I am not able to run my project. Can anyone please help me to solve this?

12条回答
Juvenile、少年°
2楼-- · 2020-01-27 12:52

I had the same problem with an ever-increasing number of facets - first 2, then 4, then 5 - and none of the above solutions worked. My solution (Android Studio 3.3, OS X) was to delete ~/Library/Preferences/AndroidStudio3.3/disabled_plugins.txt, which contained org.jetbrains.android and org.jetbrains.maven

I imagine if you have deliberately disabled plugins then you'll have to disable them again manually, but I was able to load all facets again.

查看更多
时光不老,我们不散
3楼-- · 2020-01-27 12:53

I was facing this problem, I tried everything but nothing worked but then I remembered that I updated Android Studio just few hours back and then I enabled the plugins in the Android Studio and restarted it and it worked.

File -> Settings -> Plugin and then just press ok. It will ask to restart the android studio and please restart it.

查看更多
冷血范
4楼-- · 2020-01-27 12:56

For me I had to uncheck the plugin Android APK Support. I clicked Apply and then Ok to close the window. Android Studio prompted me to restart the program, and the program restarted. I checked the Android APK Support plugin again and restarted the program. And then I selected File -> Sync Project with Gradle Files

Then it worked just fine.

查看更多
你好瞎i
5楼-- · 2020-01-27 13:00

'Android Support plugin' will do the trick.

Check if your Android support plugin is disabled / uninstalled. If so please re-enable / install it.

Then restart the studio.

查看更多
在下西门庆
6楼-- · 2020-01-27 13:01

For me I went to Settings -> Plugins and de-selected Gradle then immediately re-selected it. Android Studio then asked if I wanted to enable Groovy so I said yes and let it restart and now everything is happy again! (it was checked, but clearly somewhere deep down not truly enabled, so toggling the check-box sorted it)

Not sure if my cause was installing Flutter, but I did have to disable the Flutter plugin before I could build again.

查看更多
我想做一个坏孩纸
7楼-- · 2020-01-27 13:04

Just re-enable Android Support plugin. Then it will ask to restart. Say yes. That's it.

查看更多
登录 后发表回答