Eclipse libGDX can't run as Android Application - java

I have a libGDX project in Eclipse which of course uses Gradle. When I try to run the AndroidLauncher, I don't get an option to run it as an Android Project. I only get two options which are Gradle Build and Gradle Build... (Same thing with "..."). The odd thing is that if I first right click on the AndroidLauncher.java and click anything and try to run the project, then it works. It works until I change the core code class. Then it only has the same two options again. How can I solve this and always run it as an Android Project.

Rather than running the AndroidLauncher.java, running the project folder solved the problem. It now always runs as an Android Project.

Related

Cannot run project - the selection cannot be launched and there are no recent lanuches

i have following problem:
Yesterday i worked on my selenium&maven project in java on eclipse and after work i export project as archive, today i want to import whole project and run it on second computer, but i receive 'the selection cannot be launched and there are no recent lanuches'.
I tried run configuration, but there's no effect.
My archive is available here: https://drive.google.com/open?id=1BB0tqege1iWE_qdbHSEhfvNuFqPa8SO7 or https://github.com/mtpx/af/tree/master/automationFramework
How can I execute this project?
It using Selenium, Maven and TestNG, so there's no main class here
Maybe the project you have in hands was not exported properly, missing important metadata for the compiler.
Make sure the project is being correctly exported using (right click) export option and not only copy+paste/zip+share.

Unable to config and run a Java project in IntelliJ

Me and a few other students are building a game with Java at university. Someone else setup the basic structure for the project and i pulled the repo and tried to run it.
When i run it i get
this window
When i open the config, i am unable to add the main class, it is located in the file shown in the image. The OK button is disabled. You can see that here.
I'm running the latest version of IntelliJ, JDK 9 and Windows 10. The project in question is built with LibGDX. The full repo and folder structure can be seen here.
I am able to setup my own project and run my own apps, i just can't run this specific project.
Please help.
I think, since you have no "Java" directory, Intellij does not recognize any folder as Java Sources. You'll have to do that manually by rightclicking and mark the desired directory as Source root.
I figured out what the problem was, and of course - it was obvious. The project was setup with an old version of Gradle (2.4) and i was running Java 9. I installed Java 8 and made the project run.
The OK button was disabled because the project hadn't built properly (i though it had) so it couldn't find the class i needed to run it.

Libgdx Crashes upon execution. No error messages

I create my project using the LibGDX setup tool and import it using eclipses, but when I test the project, without making any modifications, No windows pop up, and the program terminates.
I've tried both importing it as a Gradle and as a project.
I had the project working 1 week ago, but I cannot seem to get the project to run anymore.
Previous versions of LibGDX and Eclipse dont work either
Not sure if this will help you or not:
When you create your libGDX project, create it in folder that is NOT within the workspace folder you wish to use for Eclipse - that can cause quite a lot of unexpected results.
A basic setup as follows has always worked for me, first time, every time:
C:\MyProjects\MyLibGdxProject\libGDX <- Target folder for libGDX (not within Workspace)
C:\MyProjects\MyLibGdxProject\workspace <- Workspace for Eclipse

How to convert a specific android project built with ant to gradle?

I am using this framework for one of my projects and i have problems keeping it up to date. It is a little old, uses ant to build the components and is meant for eclipse. I usually use android studio and use gradle to build from interface(not command line).
The project has a host and plugins that are loaded from a server. The plugins are compiled from the command line cmd from windows using "tools/update.sh workspace" and "ant release" commands.
What i succeded so far:
I manually copyed the files from the host component and succeded without too much stroogle to do an android studio project and build it with no errors. And it succesfully loading the plugins.
On the plugin side I have to projects: for every new plugin i do a special android studio project and after everything is ok I adapt the code and copy it to a special template like eclipse project(i edit it with notepad++ no need for eclipse) and i build it with "ant release". That apk then i move it to server.
You see now that it is a little strange but somehow I made it to work. Problem is I'm always on the edge, I almost make it every time with little hacks to pass the build process. I think it is because i work in a mixed situation. I want to port everything on android studio and gradle. And hopefully build everything from the android studio command line.
The host builds in a jar file and is used in the plugin build.
I will put the new source code on request, till then you can see it in action here
To be more specific, the impassable bug appeared when i used MediaPlayer on the plugin. I had to move the wav files on the host witch is opposed to the framework design. But this is anyway the tip of the iceberg. So i would like to port everything from ant to gradle, and eclipse to android studio.
Thanks for your help.
If you have any existing project open in your Android Studio then just close that project. After your project is closed, it will show you a Welcome screen popup, there you can select Import Project option and it will automatically convert your project into Android Studio Project.
Here is what it will look like

Is there a way to deploy Libgdx Desktop application with Android Studio (An IntelliJ Idea based IDE)

I have read this article about deploying libgdx application on linux, windows and macs.
However, it only describes how to export using eclipse. I am currently using Android Studio and it deploys android *.apk files very nicely. And I intend to keep using this. However, I had not figured out a way to deploy the desktop version of the project.
Can anyone tell me how to deploy a Libgdx Desktop application with Android Studio (or Intellij Idea because they are pretty much the same).
you can simply click on Gradle panel in the right, select :desktop, press the Execute Gradle Task, type dist and press enter, that's it.
Jar is located in /desktop/build/libs.
lbalazscs gave you a more detailed answer, so i recommend you doing what he said.
Yes, tell Gradle to build a jar for you. Here's how.
In Android Studio you can start the Gradle tasks from the GUI on the right side. Anyways, I recommend you to learn first without an IDE.
You can setup Android Studio to run the desktop version by setting up a new run configuration. Then you can run the desktop version just like you would the Android version.
Follow this link: Configuring a libGDX project to run as a desktop application in Android Studio.
In GUI we can do it.
Menu: Run -> Edit Configurations -> Add New Gradle Configurations
Gradle project: choose main Gradle project
Taske : gradlew desktop:dist
Then Run this configuration.
From this link:
exporting-a-libgdx-game-as-executable-jar-from-android-studio
A simple way of deploying on windows is to make a jar using gradle with the command gradlew desktop:dist in terminal. A similar command can be used on Linux as well.

Categories