No Android Facet Found in Module

2019-03-29 12:57发布

问题:

I just switched to Android-Studio from Eclipse. I am trying to run my application after setting up the gradle files. The project builds with no errors, however I can not run my app because there are no android facets found.

When I go to project structure there are no facets and I do not see any way to add a facet. How can I run my application?

回答1:

I solved it by removing the .idea folder and any .iml files and then re-import the project into Android Studio.

If after importing you end up with the error No facet found in module you need to follow this steps

Go to Run/Edit Configurations and you will see at lest two configurations one with the name of the original name my project: lets call it helloWord and another called app

The one with the original name helloWord was having this problem, but the configuration called app worked fine (I was able to run it)

So delete the setting with the facet problem helloWord and renamed the one called app back to the name of my project helloWord



回答2:

Th solution for me was to create a new project in android-studio. Then, copy over the code, resources, and dependencies to the new project. Then finally update the Gradle files manually and sync. Not perfect, but it worked and I can now upload to my device.

EDIT: This works but the method marked as the answer is what I was looking for.



回答3:

I just solved my problem with the following steps, walk through with me:

1) File -> Project Structure, or press (Ctrl+Alt+Shift+S) shortcut to open "Project Structure".

2) Select Facets which is under the Project Settings tab. (First column)

3) Click on + button which is at the top of the Second Column to add new facets.

4) Select Android facet from that Add menu which will prompt another dialog box to select a module. (Select a module to which you want to apply this facet).

5) Select your module and that's it.

Happy Coding!! ;)