39

So, following the advice on this SO post (sorry, I would comment there expect I don't have enough reputation)

Gradle: FAILURE: Could not determine which tasks to execute

I removed the tags from my .iml files, which allows me to compile. But when I go to run the .apk on a device, I get the error

"Error running TestProject: No Android facet found for TestProject"

Can someone help please, just want to get back to writing Android apps!

Paresh Mangukiya
  • 37,512
  • 17
  • 201
  • 182
Bradley Bossard
  • 2,389
  • 2
  • 22
  • 29
  • 1
    In my project directory, I had two .iml files -AppNameProject/AppNameProject.iml and AppNameProject/AppName/AppName.iml The project-level one is where you need to delete the component tag, but you need the Android Facet in AppName.iml. Did you delete the tags from the correct .iml file? – alikonda Jul 16 '13 at 22:49
  • Hmm, thanks for replying, wish I had this answer a couple days ago. I *think* I tried deleting it from both, then only one and only the other, but not 100% sure. In the end, I ended up having to recreate the project from scratch using the newest version of Studio, push my code and /res over to it, and it seemed to fix things. Painful being on the bleeding edge sometimes. – Bradley Bossard Jul 16 '13 at 23:55

4 Answers4

68

Add an android facet to your module by following below steps.

1) Go To File Menu -> 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. :)

Hope this will solve your problem.

Moin Ahmed
  • 2,898
  • 20
  • 33
4

At the toolbar left of the run and debug button there is a drop down. Select your project main activiy.

Ivo Stoyanov
  • 14,749
  • 5
  • 56
  • 61
4

In my case, it helped to just go to "Edit Configurations..." and delete the current configuration. Then I just created a new one with the default options.

nerdinand
  • 876
  • 12
  • 21
0

A facet represents a certain configuration, specific for a particular framework/technology associated with a module. A module can have multiple facets. E.g., Spring-specific configuration is stored in a Spring facet.

Manually add a facet to a module

  1. In the Project tool window Alt+1, right-click the module to which you want to add a facet, and select Add Framework Support.

    enter image description here

  2. Select the necessary framework from the list.

    Depending on your choice, you might be prompted to configure additional settings (for example, to configure a library).

  3. Apply the changes and close the dialog.

    enter image description here

Paresh Mangukiya
  • 37,512
  • 17
  • 201
  • 182