120

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?

liya
  • 1,525
  • 3
  • 12
  • 15

10 Answers10

280

Just enable Android Support plugin.

  1. Click Ctrl+Alt+S in Windows or Meta+Comma in Mac.
  2. In top search bar type "plugin".
  3. On right side it will show a list of plugins, find Android Support plugin, check it and click OK at the bottom of screen.

This is how it looks:

How to solve "cannot load 2 facets-unknown facet type:android and android gradle" problem

Johnny Five
  • 987
  • 1
  • 14
  • 29
Rajbir Shienh
  • 2,965
  • 1
  • 14
  • 21
  • 8
    I wonder why it was disabled in the first place. Never did it and suddenly I got those same errors. – CJ_COIMBRA Nov 11 '15 at 01:03
  • Reenable red plugind in your plugin list – profimedica Nov 23 '15 at 07:00
  • 6
    `Unable to apply changes: plugin "Google Cloud Testing" won't be able to load`. I got this error while enabling this. – Janki Gadhiya Apr 23 '16 at 09:21
  • 5
    disable that plugin @jankigadhiya in the same way we enabled Android Support – Rajbir Shienh Apr 26 '16 at 17:14
  • Strange I have mine already enabled. What I did on my end is to just uncheck and check it again. Then press ok. It seems to work now. – Neon Warge Dec 15 '16 at 06:38
  • I tried doing exactly the same, but still unable to install that plugin. The error I am getting is `Unable to apply changes: plugin "Android Support" won't be able to load.` --- https://imgur.com/a/XsuFf – Narendra Singh Feb 18 '18 at 07:04
  • 1
    As suggested above by Zeus25, uncheck the Plugins that the error message complains about, and then re-check them, this should prompt Android into downloading the necessary dependencies for these plugins and ask you to restart the IDE. – Jonathan Dunn Jul 02 '18 at 09:00
  • This happened to me after Android Studio caused a windows bluescreen after trying to startup an emulator. The next time I opened android studio after the bluescreen it just showed a stack trace and asked me to report the error to some site. Then I opened it again and it was a blank slate with the android plugins disabled. Enabled the plugins and now everything is working. Thanks! – Alex Egli Dec 18 '19 at 15:57
67

In Android Studio go to

File -> Settings - > Plugins -> Enable "Android Support" Plugin.

enter image description here

hims_3009
  • 1,737
  • 14
  • 23
2

File, Then Settings->Plugin->Enable/Renable Plugin --> Apply --> Restart

Shubhamhackz
  • 7,333
  • 7
  • 50
  • 71
2

This problem occured when i'd updated Android Studio.

In case nothing from other answers works, you don't have another option, except removing broken settings and making clean setup.

So what i am suggesting:

  • Use Settings Repository Feature to store personal IDE settings
  • close studio
  • remove .AndroidStudioX folder from user folder
  • re-launch studio, do not copy settings from previous version (because settings probably broken and auto-import couldn't import it well)
  • import personal settings from Settings Repository
Beloo
  • 9,723
  • 7
  • 40
  • 71
  • Did this happen when you updated to Android Studio 3.1.0? – fawaad Mar 29 '18 at 14:35
  • @fawaad Yes, it did – Beloo Mar 29 '18 at 14:39
  • Do you know if there is an alternative method where you can keep your previous settings? I'm planning on looking this up later, just wondering if you know off hand. – fawaad Mar 30 '18 at 20:43
  • As I mentioned in answer you can do it through settings repository or via export settings in options tab. Other settings not in the set won't be keeped – Beloo Mar 31 '18 at 21:05
2

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.

noelicus
  • 14,468
  • 3
  • 92
  • 111
  • I disabled and reenabled Android ADK to solve the problem. (Better than doing the same with Gradle, on which lots of other plugins depend.) – vishvAs vAsuki Jan 19 '19 at 23:37
  • I believe it might have something to do with installing a cross-platform tooling. I suddenly ran into this problem after setting up React Native on my (Windows) machine. I had not touched Android Studio nor the SDK at all in the meantime, so it was pretty baffling how it sudenly got broken behind my back. – Konrad Morawski Feb 06 '19 at 14:53
2

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.

icodestuff
  • 340
  • 1
  • 11
1
  1. Go To ->File->Settings->Plugins->disable/enable Android Support Plugins->Press Ok Just re-enable Android Support plugin. Then it will ask to restart. Restart them thats it
0

I faced this issue in Android Studio 3.2.1 I had to re-import my project after that it works.

Peter
  • 260
  • 5
  • 3
0

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.

Papershine
  • 4,995
  • 2
  • 24
  • 48
0

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.

Maryoomi1
  • 113
  • 1
  • 3
  • 16