Exporting A Libgdx Game as Executable Jar from Android Studio
Asked Answered
E

2

13

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?

Endotoxin answered 30/8, 2015 at 23:39 Comment(0)
P
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

Pennell answered 30/8, 2015 at 23:49 Comment(3)
um I don't really understand the gradlew stuff, where do I type this?Endotoxin
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 commandsEndotoxin
(For IntelliJ) You can open the "Gradle" panel at the right of theIDE and expand ":desktop", "other" and then double click on ":desktop:dist"Keyway
T
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.

Torsibility answered 9/8, 2017 at 19:6 Comment(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 thereImpolitic
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.Aquinas

© 2022 - 2024 — McMap. All rights reserved.