No desktop build/run configuration

Anything libgdx related goes here!

No desktop build/run configuration

Postby realh » Fri Nov 20, 2015 5:18 pm

I just created a new libgdx project and although I ticked all the variants (android, desktop etc) in the setup tool, it's only created a build/run configuration for Android. I've tried adding a desktop configuration as described at https://github.com/libgdx/libgdx/wiki/Gradle-and-Intellij-IDEA but when run it fails:

Code: Select all
Exception in thread "main" java.lang.ClassNotFoundException: uk.co.realh.parallax.desktop.DesktopLauncher
.

There is nothing in the desktop/build directory except resources/main which is empty.

In the Run/Debug Configurations dialog there is a section for Before Launch: Make ..., which I would have thought has something to do with making sure the project is (re)built before running. It contains one entry "Make", and the edit icon for it is greyed out.

How do I get this working?
realh
 
Posts: 12
Joined: Fri Oct 03, 2014 3:23 pm

Re: No desktop build/run configuration

Postby evilentity » Fri Nov 20, 2015 6:03 pm

You need to create it yourself. Edit configuration -> new application -> pick desktop starter class as main, pick working directory as android/assets, classpath of desktop module.
Looking for a freelancer? PM me!
Check out libgdx discord server!
evilentity
 
Posts: 4727
Joined: Wed Aug 24, 2011 11:37 am

[Solved] Re: No desktop build/run configuration

Postby realh » Fri Nov 20, 2015 7:15 pm

evilentity wrote:You need to create it yourself. Edit configuration -> new application -> pick desktop starter class as main, pick working directory as android/assets, classpath of desktop module.

I did that, it's the process described in the link in my original post.

I think I've fixed it now, but I'm not exactly sure how. I found that when I clicked on the build button in the toolbar the build process was just hanging, using loads of CPU. I thought maybe if I ran gradle from the command line I might be able to get more info out of it even though I don't really know anything about gradle, so I ran the gradlew script in the project, with no arguments at first. It downloaded a zip and did some stuff with it, and that seemed to clear the problems!
realh
 
Posts: 12
Joined: Fri Oct 03, 2014 3:23 pm

Re: No desktop build/run configuration

Postby drkpoon » Fri Nov 20, 2015 7:42 pm

You can try the following:
Right click on DesktopLauncher and select 'Run DesktopLaunche...main()'. A desktop run configuration will be generated.
You then modify working directory to assets directory of Android module.
drkpoon
 
Posts: 26
Joined: Sun Feb 15, 2015 4:43 pm

Re: No desktop build/run configuration

Postby Fringale » Fri Nov 20, 2015 8:02 pm

Just tested, and I confirm I have the same issue in IntelliJ 15.0.1 in LibGDX projects that have an Android subproject: running the desktop app with an 'application' configuration (with proper settings: class path, working dir, etc.) fails with the exception described above. I didn’t encounter it until now as I use the :desktop:run Gradle task instead.

It must be linked to this issue, since the error disappeared once I added the Java-Gradle facet to the core and desktop modules (in 'Project Structure…') and refreshed the Gradle project.

IntelliJ 15 sure seems to have some Gradle/Android related problems. : /

Edit: it seems to only happen when the project has an Android subproject.
Last edited by Fringale on Thu Nov 26, 2015 3:46 pm, edited 1 time in total.
Fringale
 
Posts: 85
Joined: Sat Nov 15, 2014 1:01 am

Re: No desktop build/run configuration

Postby realh » Fri Nov 20, 2015 8:26 pm

I didn't check the Project Structure/Settings (why is it called one thing in the menu and another in the dialog?) while I was experiencing the problem, and I don't even know what a Java-Gradle facet is, but they are appearing in the Project Settings now.

I suspect this version of IntelliJ just needed a newer version of the gradle wrapper than the one libgdx-setup added.
realh
 
Posts: 12
Joined: Fri Oct 03, 2014 3:23 pm

Re: No desktop build/run configuration

Postby kazi » Thu Nov 26, 2015 12:19 am

Was having the same issue in IntelliJ 15.0.1 and it was driving me up the wall. Can confirm that running the Gradle :desktop:run task works, but creating a run configuration in IntelliJ does not.

How do I go about adding a Java-Gradle facet?
kazi
 
Posts: 20
Joined: Mon Dec 15, 2014 4:11 am

Re: No desktop build/run configuration

Postby Fringale » Thu Nov 26, 2015 4:40 pm

kazi wrote:How do I go about adding a Java-Gradle facet?

Either go to 'File => Project Structure…', or right-click on a module in the project tree => 'Open Module Settings'. From there, go to the 'Modules' item under 'Project Settings' and use the '+' button to make sure the 'Java-Gradle' facet is listed for all modules except Android. Finally, refresh the Gradle project (not sure if necessary, but it cannot hurt), and the desktop run configuration should work again.

Those 'xxx-Gradle' facets (Android-Gradle, Java-Gradle) are only used (and necessary) when the project has an Android subproject - Android is a bit of a special beast when it comes to Gradle usage. From my understanding, those facets replicate at the IDE level the 'apply plugin' instructions (apply plugin: "android", apply plugin: "java") found in build.grade for each subproject…except that at the moment, some of them are not generated automatically on import as they should.
Fringale
 
Posts: 85
Joined: Sat Nov 15, 2014 1:01 am

Re: No desktop build/run configuration

Postby mzechner » Thu Nov 26, 2015 10:07 pm

Bah, the IntelliJ IDEA Android plugin is at fault here. What an annoying bug. I brought it up with JetBrains, hope they fix it in 15.0.2

https://youtrack.jetbrains.com/issue/IDEA-147788
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: No desktop build/run configuration

Postby Fringale » Fri Nov 27, 2015 3:35 pm

Yup, saw your issue when looking for reference on that problem. : )

I just added a note in the wiki setup page so that LibGDX newcomers get a heads-up, will remove it when this gets fixed.
Fringale
 
Posts: 85
Joined: Sat Nov 15, 2014 1:01 am

Next

Return to Libgdx

Who is online

Users browsing this forum: Google [Bot] and 1 guest