+ -

Pages

Tuesday, 21 January 2014

Eclipse - Run As- None Applicable Problem

Now as I am ready to check if things are set up well, I don't see how to run this 'MyFirstApp'. The Android guide says :
To run the app from Eclipse:
  1. Open one of your project's files and click Run  from the toolbar.
  2. In the Run as window that appears, select Android Application and click OK.
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 :


I Googled the problem and found this solution which suggests that there has to be one Main method..

public static void main(String[] args)..

but there is no mention of any such thing in Android Guide. I am confused now.

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.
5 Learning Android - from the scratch: Eclipse - Run As- None Applicable Problem Now as I am ready to check if things are set up well, I don't see how to run this 'MyFirstApp'. The Android guide says : To r...

7 comments:

  1. thanks,I search for this problem on google. This webpage comes first。

    ReplyDelete
  2. This problems does not exists in Android Studio - no matter what file is active it always knows to run the project.

    ReplyDelete
    Replies
    1. bravo amazing. im going to uninstall eclipse ide and download it. thanks alot. im doing it rn

      Delete
  3. I was facing the same problem because I had written main method as
    public 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

    ReplyDelete
  4. THAAAAAAAAAAAAAAAAANKS YOU ARE AWESOME <3

    ReplyDelete

< >