But I can't find anything there. I see '(none applicable)' when I hover the mouse on Run As. Here is how it looks like :To run the app from Eclipse:
- Open one of your project's files and click Run
from the toolbar.
- In the Run as window that appears, select Android Application and click OK.
I Googled the problem and found this solution which suggests that there has to be one Main method..
public static void main(String[] args)..
I also learnt that the Run button in Eclipse doesn't function when you're on an XML file, it has to be .java file for Eclipse to run the program. But that's not what is wrong here.
I finally figured it out. When the focus is on MainActivity.java file, I see nothing in Run As, but when I selected package com.example.myfirstapp, I see other options. Here is the screenshot :
Great! I guess now I know what was wring but I still don't see any option to run it on AVD. So, problem still persists.
Okay, I guess no such option is there on Eclipse. I have to use 'Run As Android Application' and it's working now. Yes! Things are moving!
Note : Remember that you need to start the AVD first, otherwise ADT would assume that you're trying to run it on your phone. Also note, AVD may take very long time to start up.
thanks,I search for this problem on google. This webpage comes first。
ReplyDeleteThis problems does not exists in Android Studio - no matter what file is active it always knows to run the project.
ReplyDeletebravo amazing. im going to uninstall eclipse ide and download it. thanks alot. im doing it rn
DeleteThanks !!!!
ReplyDeleteI was facing the same problem because I had written main method as
ReplyDeletepublic static void main(){}
But as soon as i wrote it as below
public static void main(String[] args)
I could see run as java application
THAAAAAAAAAAAAAAAAANKS YOU ARE AWESOME <3
ReplyDeleteThanks....
ReplyDelete