16

I have an android project with dependencies on actionbar sherlock. It compiles without error but the run Button is disabled. I have another android project that works fine and runs on my device, but I cannot see the difference between those projects - except I am able to run the one project and I am not able to run the other.

I would provide screenshots, but actually I don't have any idea where this problem is located.

Any idea?

Anthea
  • 3,741
  • 5
  • 40
  • 64
  • 1
    Sometimes it might help to restart the IDE, or hit the 'synchronize' button manually. Which version of IDEA are you using? I am aware of v12 having synchronization issues sometimes. – Mathias Conradt Feb 15 '13 at 10:51
  • Possible duplicate of [Run Button is Disabled in Android Studio](https://stackoverflow.com/questions/28385172/run-button-is-disabled-in-android-studio) – Hassan Jamil Apr 18 '18 at 08:30

3 Answers3

46

Did you set up a Run/Debug Configuration?

You should see a drop down to the left of the Run button; click it and click "Edit Configurations". In the top-left, click the "+" to add a new configuration, and select "Android Application". Select the Module (usually it's just your main project) to launch, choose the Target Device (hardware or emulator), give it a name, and then click OK.

Now you should be able to run with that configuration.

Kevin Coppock
  • 133,643
  • 45
  • 263
  • 274
  • 6
    is displays. How can I generate module > – Vineesh TP Oct 14 '15 at 08:55
  • A minor note: If the project still does not allow running, try building the project "Build -> Build project", then redoing the run configurations, solved for me. – Bonatti Sep 21 '17 at 13:48
5

In 2017, IntelliJ idea wants to index stuff for several minutes before it will enable the Run option.

This appears to be by design.

Warren P
  • 65,725
  • 40
  • 181
  • 316
1
  1. Right-click the class file with the main method on the project view.
  2. Select Run.

Run configuration is created automatically so that you don't have to set it.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Tonnie
  • 4,865
  • 3
  • 34
  • 50