I am using Android Studio Electric Eel | 2022.1.1 Patch 2.
I have noticed that on some occasions, the Run button in Android Studio becomes disabled without any apparent reason. This can be seen in the attached Image A.
This problem persists even after rebuilding the project. However, I have found that I can resolve the issue by closing and reopening Android Studio.
What could be causing this issue with Android Studio?
2
Answers
Click Run on the menu and then Edit Configurations… then click on Android Application on the left and click the + button. Choose Android Application from the pop-up menu. Then pick the module (its normally app or something like that). Then click apply and ok.
If you have more errors after that, try to re-import the project in Android Studio.
If this doesn’t solve your problem, something I noticed is that while Android studio is loading, the button can be disabled while necessary libraries load. In addition, if you have not specified a device to run the code on or have compiling issues the button may be disabled too. Good luck!
(Credit to Thanos)
Usually when this happens, you just have to click the "Sync Project with Gradle Files" button to resolve it.