12

Okay so I made a game using Libgdx and I intended it to be a android app(which is why i use android studio) but I want to let my friend without android phones try it out. The project is already setup for both desktop and android so is there any way to export this as a executable jar file?

user1804234
  • 331
  • 1
  • 3
  • 13

2 Answers2

13

Type the command below in the terminal. Remember that you have to be in your LibGDX root directory, before issuing this command.

gradlew desktop:dist

More at: https://github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#packaging-for-the-desktop

Martin Rohwedder
  • 1,712
  • 4
  • 19
  • 34
TomGrill Games
  • 1,553
  • 2
  • 16
  • 25
  • um I don't really understand the gradlew stuff, where do I type this? – user1804234 Aug 31 '15 at 00:10
  • 2
    Nvm I figured it out that its the windows command line and that I need to cd to the project directory which has the build.gradle stuff and then use these commands – user1804234 Aug 31 '15 at 00:13
  • 3
    (For IntelliJ) You can open the "Gradle" panel at the right of theIDE and expand ":desktop", "other" and then double click on ":desktop:dist" – Rombus Apr 16 '17 at 01:44
4

You have to type

gradlew desktop:dist

command in Terminal in Android Studio. Then you should have an executable jar file in your project directory/desktop/build/libs.

Fiszu77
  • 51
  • 2
  • It doesn't necessarily need to be the terminal in AS. You can use any terminal to do this. Make sure the current working directory is the project root since `gradlew` is located there – Spikatrix May 23 '20 at 06:55
  • This is a MUCH better answer than the one above since the jar file is built in a weird location, I couldn't see where it was an assumed it was failed. Thanks. – Hasen Jun 09 '20 at 09:55