"Run as" android application is missing - java

SDK and ADT are installed and working, but when I run some android code, the "Run As" panel is empty. I need to go to Run configuration, click on Android application, make a copy, put the name of my project on the copy and the run it. Then it run properly on the emulator. How can I add the "android application" item menu inside the run as menu?

You could Right Mouse Button Click(on activity class) > Run As > Run Configurations. Next is Right Mouse Button Click on Android Application > New. Now you should add your virtual emulator in Target. It works in my version of IDE.
Now you can use this run configurations with your own settings.

"Run as Android application" is available if u run the project (right click project name and u have that option) , and not a specific activity file ..

Just select Run > Run in eclipse and select android application.The Eclipse plugin automatically creates a new run configuration for your project and then launches the Android Emulator.

Maybe this is a bit late to be answering this, but I think my answer is better. The right click is all fine and well, but it is a bit more effort each time than my suggestion.
Right click on the toolbar and click "Customise Perspective..."
On the toolbar structure that pops up find "Launch" (On mine it's the 5th item down - it might vary)
Then you need to tick the "Run " box
After you click "OK" it should be back in the toolbar and in the menu

Related

Could not find or load main class net.fabricmc.devlaunchinjector.Main fabricmc

I was programming a fabric minecraft mod in intellij and when I ran the code it said :
Could not find or load main class net.fabricmc.devlaunchinjector.Main
When I compiled the code and tried it in minecraft it worked, but in intellij i couldn't run it.
I was messing around with the files, to see if I can fix it and I found a solution :
Go to "Run Configuration", press the arrow to see the options and tap "Edit
Configurations"
Go to "Minecraft Client" and press the button next to
"net.fabricmc.devlaunchinjector.Main"
search trough your external libraries and find "net.fabricmc.devlauncherinjector.Main"
(it must be right under net.fabricmc-api...) select it, and after that you should see
the "Edit Configurations" window. Press "OK"
If this doesn't work, right click the file and select "Copy Full Path". Then go to
"Edit Configurations" window and paste it where it says
"net.fabricmc.devlauncherinjector.Main"
If the 2 option doesn't work either, close the project, copy the mod folder, and paste
it somewhere else(eg. Desktop, New Folder). And then open your IDE, go to open project
and select the copied folder. Press the "Build.gradle" file and select open as project
and "Trust" .It should now work. If it doesn't , unfortunately I don't know how to fix
it.
thecoopsyt's answer worked for me.
Go to Gradle tab > Reload All Gradle Projects
Wait a few mins for it to check and update your dependencies.
After this I was able to return to testing my project in Intellij... had to fully compile and test before this fix.
In Intellij gradle if
this doesn't work you can put
downloadAssets runClient into a gradle config and it will start a client and download the net.fabricmc.devlauncherinjector.Main
this allows you to use gradles built in Minecraft Client

Running Java application in Android Studio

I created new libgdx project and i want to run desktop application in Android Studio. Is there something to do with run configurations? In Eclipse i can just choose Run as Java Application.
Ok, i did it. Here is the solution https://github.com/libgdx/libgdx/wiki/Gradle-and-Intellij-IDEA#running-your-project
Run -> Edit Configurations..., click the plus (+) button and select Application.
Set the Name to Desktop.
Set the field Use classpath of module to desktop, then click on the button of the Main class field and select the DesktopLauncher class.
Set the Working directory to your android/assets/ (or your_project_path/core/assets/) folder!
Click Apply and then OK.
You have now created a run configuration for your desktop project. You can now select the configuration and run it.
Right click on the main method (or anywhere in the main class) and select Run.

Can not press "run" in Intellij idea

I have updated my Java recently and since then i can not press "run" (the green arrow) anymore.
I tried to reinstall Intellij but it did not work.
Try right-clicking within the file that contains a main method, and click "Run CLASSNAME.main()". That should generate a run configuration for the file that will let you use the green play button.

Project Selection in Run Configurations on Eclipse is Empty

I'm a newbie in Android Development. And I have this one tini-tiny problem which I'm not able to fix it. Every time I run configurations, and browse the Project name, the Project selection is empty and I cant click on any on it except the "Cancel" Button. Then I can't really launch my project. How does one fix this?
Right click on your package in the Package Explorer, click Properties, and see if you're using any libraries. Make sure that the "Is Library" box is not ticked on your project.
In my particular case I had a Maven Project Loaded into Eclipse Mars, and when I tried to run a specific main class, the project itself didn't appear in the Project List under:
Configurations -> Java Application -> Project -> Browse...
What I did was just to convert the Project to have Facets... in the Project Properties:
Main Menu -> Project -> Properties -> Project Facets
Once I did it, just selected Java and the version I needed and it started working.
In the Java Perspective choose the Run menu and go to Run Configurations
Select the item in the list titled "Android Application" and press the plus/add button.
On the next page, choose the Browse button and choose the Android App that you'd like to run.
I had the same problem and found I hadn't put the project name in Project textbox, in the first tab.

Eclipse doesn't start android app in emulator

I'm right at the beginning of android programming.
I created an AVD that works just fine when launching via the AVD-manager.
I also "created" a hello-world app as a little test.
When I try to run the app as an android app, nothing happens. No output in the console, emulator doesn't start (or launchs app when already started), no message, nothing.
Can anyone help me?
Thanks a lot
I had the same problem. I think its because u created a project with a blank activity. so when the app starts it doesn't have anything to do..
to solve the issue just add an activity, intent and a category to your manifest file and run
Not sure if this will help you but, during our android lab sessions some computers had a slimier problem. How it was fixed is by doing the following:
Next to the "Run as" button, there is a small arrow, click it.
Select "Run configurations".
On the left, double click "Android Application".
There should be 3 tabs appearing on the right (Android, Target, Common)
Under "Android", browse and select the project you want to run.
Launch Action: select "Launch Default Activity".
Click on "Target" tab.
There should be an AVD table with the Android virtual devices you created through the manager. In case there isn't, hit refresh or click on "Manager" to make sure you have created it and then refresh again.
if there is an AVD, it should appear with a small check box on the left side of it, click it and then click on "Run".
This fixed the issue for most students, hopefully it will in your case as well. If not then I hope someone can answer it for you.
If you are using Windows, Give your SDK path in Eclipse as Windows->preferences ->Android->SDK Location
here you give your sdk path.

Categories